How about this
PremierLeague = MsgBox("Include PremierLeague Matches?", vbYesNo)
fExit = False
For Each comp In Schedule
For Each rownd In Range(comp)
'test for Premier league
For Each Item In Range(comp & "_" & rownd)
If Left(comp, 13) = "PremierLeague" Then
If PremierLeague = vbNo Then
fExit = True
Exit For
End If
End If
'Do stuff
Next Item
If fExit Then Exit For
Next rownd
If fExit Then Exit For
Next comp
also.take a look at
http://www.xldynamic.com/source/xld.LeagueTable.html
--
HTH
RP
(remove nothere from the email address if mailing direct)
"David" wrote in message
...
In my code below (which runs OK), when vbNo is returned from the msgbox, I
want to skip past any comp that is Premier League. Although the code runs
Ok,
after the first test for "Premier League" in each comp, the subsequent
tests
are not required - How could I restructure to make the code more
efficient?
PremierLeague = MsgBox("Include PremierLeague Matches?", vbYesNo)
For Each comp In Schedule
For Each Rownd In Range(comp)
'test for Premier league
For Each Item In Range(comp & "_" & Rownd)
If Left(comp, 13) = "PremierLeague" Then
If PremierLeague = vbNo Then
Exit For
End If
End If
Do stuff
Next
Next
Next
--
David