ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Do loop without do? Why? (https://www.excelbanter.com/excel-programming/322127-do-loop-without-do-why.html)

John Wirt[_5_]

Do loop without do? Why?
 
This procedure produces the error "Do loop without Do? How come?
- - - - -- - - - - - -
Public Sub HideSelectedSheetsOLD()
Dim Wsh As Worksheet
Dim Counter As Integer

For Each Wsh In ActiveWorkbook.Sheets
Counter = 7
Do
If UCase(Intersect(Wsh.Columns(Counter), Wsh.Rows(1))) = "HIDE"
Then
Wsh.Visible = xlSheetHidden
Counter = Counter + 1
Loop Until Counter = 26
Next

End Sub
- - - - - - - - - -
John Wirt



JulieD

Do loop without do? Why?
 
Hi John

as far as i can tell - you're missing an END IF in the DO LOOP which is
confusing things.

Cheers
JulieD

"John Wirt" wrote in message
...
This procedure produces the error "Do loop without Do? How come?
- - - - -- - - - - - -
Public Sub HideSelectedSheetsOLD()
Dim Wsh As Worksheet
Dim Counter As Integer

For Each Wsh In ActiveWorkbook.Sheets
Counter = 7
Do
If UCase(Intersect(Wsh.Columns(Counter), Wsh.Rows(1))) = "HIDE"
Then
Wsh.Visible = xlSheetHidden
Counter = Counter + 1
Loop Until Counter = 26
Next

End Sub
- - - - - - - - - -
John Wirt





John Wirt[_5_]

Do loop without do? Why?
 
Yes, Thanks. John

"JulieD" wrote in message
...




JulieD

Do loop without do? Why?
 
you're welcome and thanks for the feedback

"John Wirt" wrote in message
...
Yes, Thanks. John

"JulieD" wrote in message
...







All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com