Macro to validate is cell is not empty and copy the line
I would like to run a macro to validate if the cell is not empty and
copy the related lines to another worksheet.
Example :
I have Sheet 1 and Sheet 2
In Sheet 1, I would like run a macro to check if Sheet2 F3 is empty.
If not copy A3, B3, C3 and D3 to Sheet 1. If the F3 is empty, go to F4
and make the same validation.
If you have any questions, feel free to contact me
Thanks a lot
Stephane Vial
Hello Stephane
Try to have a look at this.
Sub copy()
With Sheets(2)
If IsEmpty(.Range("F3")) = False Then
.Range("A3:D3").copy _
Destination:=Worksheets("Sheet1").Range("A3")
ElseIf IsEmpty(.Range("F4")) = False Then
.Range("A4:D4").copy _
Destination:=Worksheets("Sheet1").Range("A4")
End If
End With
End Sub
Regards
Per
|