Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through sheets
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through sheets
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through sheets
try this:
For Each sh In mybook.Worksheets If sh.Visible = True Then |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through sheets
Thanks for the suggestion. I tried what the earlier post recommended and it
worked. It's nice to know there are folks out there that are knowledgeable and willing to assist. Again, thanks. "JLGWhiz" wrote: try this: For Each sh In mybook.Worksheets If sh.Visible = True Then . ............... . End If Next sh "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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Looping thru Sheets without activating | Excel Programming | |||
Looping through Sheets | Excel Programming | |||
Looping through Sheets | Excel Programming | |||
Looping through sheets | Excel Programming |