Start Do/Loop within conditional statement
Hi Claus,
I'm just trying to start the loop. If I comment out the conditional piece and one pair of the instructions on either side of the Else statement, it works great. On the first condition, if the employee list is to be run according to supervisor, then a report is generated by supervisor. On the second condition, the supervisor is irrelevant and all employess are listed alphabetically. The subroutine is quite large, but to outline the process a little mo
For Each c In Rng.Cells
'Set parameters and counters
If Education = False Then
Class = Range("H" & LastRow).Value
Do While Cells(LastRow, 8).Value = Class And LastRow < 1
Else
Do While LastRow < 1
Class = Range("H" & LastRow).Value
End If
'Extract data and format
'Error checking, too.
Loop
Next c
On Tuesday, January 13, 2015 at 12:57:08 PM UTC-6, wrote:
Hi,
Is it possible to start a Do/Loop with a conditional statement? The code I have is:
If Education = False Then
Class = Range("H" & LastRow).Value
Do While Cells(LastRow, 8).Value = Class And LastRow < 1
Else
Do While LastRow < 1
Class = Range("H" & LastRow).Value
End If
and this is nested in a For/Next routine. When I attempt to run it, I get a "Compile error: Else without If." There is a similar error if I try to use Select/Case routine. If what I'm trying to do isn't possible, then is there a work around to it?
Thanks,
James
|