Skip blank cells in a For...Each Loop

Hi Experts,

I have a For...Each loop like below:

 For Each ServiceLineValues In ServiceLineValuesRange
           If ServiceLineValues = "" Then
               MsgBox "AAAAA"
           Else
               Some other code I want to execute
           End if
 Next ServiceLineValues

Open in new window


When the cell range evaluates to true I just want to ignore this and move on to the next cell. At the moment it seems that I have to put some statement in there like Msgbox "AAAAA" just to make this work.
onesegunAsked:
Who is Participating?
 
StephenJRConnect With a Mentor Commented:
Like this?

 For Each ServiceLineValues In ServiceLineValuesRange
           If ServiceLineValues <> "" Then
               Some other code I want to execute
           End if
 Next ServiceLineValues
0
 
onesegunAuthor Commented:
Doh!!!!!
0
 
Dave BrettVice President - Business EvaluationCommented:
While this is closed you can use SpecialCells to work with formulas/constants only as an inpu to the working range rather than testing cell by cell within the loop
0
All Courses

From novice to tech pro — start learning today.