@daffodil: you'd really need to go for this (without the third Select)
Sub Lateralus()
Range("C1").Select
Selection.End(xlDown).Select
x = ActiveCell.Offset(0, -1)
' Test if the value in neighboring cell is blank/empty
If x = "" Then MsgBox "Cell is empty"
End Sub
And the OP's original code would have worked too, without that third Select.
Sub Sample_TMS1()
Range("C1").Select
Selection.End(xlDown).Select
x = ActiveCell.Offset(0, -1)
' Test if the value in neighboring cell is blank/empty
If IsEmpty(x) = True Then
MsgBox "v1: Cell " & ActiveCell.Offset(0, -1).Address & " is empty"
End If
End Sub
' or, making x a range:
Sub Sample_TMS2()
Range("C1").Select
Selection.End(xlDown).Select
Set x = ActiveCell.Offset(0, -1)
' Test if the value in neighboring cell is blank/empty
If IsEmpty(x) = True Then
MsgBox "v2: Cell " & x.Address & " is empty"
End If
End Sub
Regards, TMS
Bookmarks