E
ExcelMonkey
I have a loop which loops through sheets and cells via the SpecialCells
Method. If I come to a sheet which is blank I want the code to exit the loop
and proceed onto the next sheet. The error handling below does not do this.
What changes do I need to make?
For Each sht In ThisWorkbook.Worksheets
sht.Activate
On Error Resume Next ' Added in event that sheet does not have
formulas
For Each rng In sht.UsedRange.SpecialCells(xlCellTypeFormulas)
If Err.Number <> 0 Then
Exit For
Else
rng.Select
End If
Thanks
EM
Method. If I come to a sheet which is blank I want the code to exit the loop
and proceed onto the next sheet. The error handling below does not do this.
What changes do I need to make?
For Each sht In ThisWorkbook.Worksheets
sht.Activate
On Error Resume Next ' Added in event that sheet does not have
formulas
For Each rng In sht.UsedRange.SpecialCells(xlCellTypeFormulas)
If Err.Number <> 0 Then
Exit For
Else
rng.Select
End If
Thanks
EM