Sub If_Test1()
If Range("a1").Value = " " Then
Range("a2").Select
ElseIf Range("a2").Value <> "" Then
Range("a2").Copy
Else
MsgBox "C9 & E9 are Blank please check"
End If
End Sub
CodePudding user response:
Put "" except " " in condition as
If Range("a1").Value = "" Then Range("a2").Select
because " " doesn't mean a blank cellexcept
If Range("a1").Value = "" Then Range("a2").Select
I'd preferIf Len(Range("a1"))>0 Then Range("a2").Select
Also you can use
If IsEmpty(Range("A1")) = True Then Range("A2").Select
CodePudding user response:
Thank you myself
Sub Test1()
If Worksheets("sheet1").Cells(1, 1).Value = "" Then
Worksheets("sheet1").Cells(2, 1).Copy
Else: Range("a1").Copy
End If Range("D3").PasteSpecial xlPasteValues
Activeselection = False
End Sub