View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
ReportSmith ReportSmith is offline
external usenet poster
 
Posts: 34
Default Looping through sheets

I don't think my earlier reply was received...but in any case...I need to do
a lot of consolidating of non-standardized data on every sheet, so I have
nested loops and if..thens. I tried your suggestion and it worked.

Thank you.

"JE McGimpsey" wrote:

Why do you want to select the sheets? Using worksheet and range objects
directly is faster and easier to maintain.

However, if you really want to select, then

For Each sh in mybook.Worksheets
If sh.Visible = xlSheetVisible Then
sh.Select
'...
End If
Next sh


In article ,
ReportSmith wrote:

I have code (Excel 2000) that loops through all the visible sheets in a
workbook. Problem is, when the code gets to the "next.sh" line, the next
worksheet is not selected.

For Each sh In mybook.Worksheets
if sh.visible = xlsheetvisible then
.
...............
.
end if
next sh

Any ideas?

Thanks.