Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default long if statement

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Long If Statement Michael Excel Worksheet Functions 5 July 21st 08 05:08 PM
IF statement too long, need another way Lady_Olara Excel Worksheet Functions 4 April 12th 06 10:28 AM
very long statement Frank Drost Excel Discussion (Misc queries) 0 January 18th 06 08:47 PM
IF statement too long KSH Excel Discussion (Misc queries) 6 November 3rd 05 07:28 PM
Long IF Statement rmitchell87 Excel Discussion (Misc queries) 2 October 2nd 05 03:50 AM


All times are GMT +1. The time now is 12:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"