PDA

View Full Version : [SOLVED] If E and F is empy paste to column



parscon
04-04-2018, 03:46 PM
Hello This is my code that will check column M and if it is empty will copy column L to Column E and Column K to Column F and now i want to add check column E and F and if they are empty do the paste .
Hope you can help me on this subject .
Thanks for your help and time.


Sub Clear()
Dim r As Range
For Each r In Intersect(Range("M:M"), ActiveSheet.UsedRange)
If IsEmpty(r) Then
r.Offset(, -1).Resize(, 1).Copy r.Offset(, -8)
r.Offset(, -2).Resize(, 1).Copy r.Offset(, -7)
End If
Next
End Sub

Bob Phillips
04-04-2018, 04:58 PM
Is this what you want?


Sub Clear()
Dim r As Range
For Each r In Intersect(Range("M:M"), ActiveSheet.UsedRange)

If IsEmpty(r) And IsEmpty(Cells(r.Row, "E")) And IsEmpty(Cells(r.Row, "F")) Then

r.Offset(, -1).Resize(, 1).Copy r.Offset(, -8)
r.Offset(, -2).Resize(, 1).Copy r.Offset(, -7)
End If
Next
End Sub

parscon
04-04-2018, 10:44 PM
Thank you so much