Link to home
Start Free TrialLog in
Avatar of onesegun
onesegunFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of StephenJR
StephenJR
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of onesegun

ASKER

Doh!!!!!
Avatar of Dave
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