View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default long if statement

LiSa

maybe you could use something like this:

Sub test1()
If WorksheetFunction.CountA(Range("A1:A3")) = 3 Then
MsgBox "execute code"
End If
End Sub

Instead of:

Sub test2()
If Range("A1") < "" _
And Range("A2") < "" _
And Range("A3") < "" Then
MsgBox "execute code"
End If
End Sub


Regards

Trevor
"LiSa" wrote in message
...
I'm sure there must be a short way of doing this
I only want the code to execute if all the cells in a
range are filled. So far I have this.
All the cells are on the same row


If range("A1")<"" and range("A2")<"" _
and range("A3")<"" etc etc then
execute code
end if

TIA