Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Avoiding a hidden sheet
I currently have code to loop through the number of sheets in a workbook.....
Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum)) For Each sh In mybook.Worksheets ......but I need to loop 1 less than the total number of sheets to avoid a hidden sheet in the same workbook - in other words, I need something like..... For Each [sh-1] In mybook.Worksheets.......... Any suggestions? Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Avoiding a hidden sheet
Just avoid the hidden sheets.
For Each sh In mybook.Worksheets if sh.visible = xlsheetvisible then 'do what you want end if next sh ReportSmith wrote: I currently have code to loop through the number of sheets in a workbook..... Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum)) For Each sh In mybook.Worksheets .....but I need to loop 1 less than the total number of sheets to avoid a hidden sheet in the same workbook - in other words, I need something like..... For Each [sh-1] In mybook.Worksheets.......... Any suggestions? Thanks in advance. -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Avoiding a hidden sheet
Thanks Dave. When I saw your post, I thought "Duh" - I should've known that
- but I've been staring at this code for too long and don't know where I am anymore. I'll try it out. Again, thanks. "Dave Peterson" wrote: Just avoid the hidden sheets. For Each sh In mybook.Worksheets if sh.visible = xlsheetvisible then 'do what you want end if next sh ReportSmith wrote: I currently have code to loop through the number of sheets in a workbook..... Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum)) For Each sh In mybook.Worksheets .....but I need to loop 1 less than the total number of sheets to avoid a hidden sheet in the same workbook - in other words, I need something like..... For Each [sh-1] In mybook.Worksheets.......... Any suggestions? Thanks in advance. -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Avoiding a hidden sheet
Sometimes, the extra set of eyes is enough to get you going again.
ReportSmith wrote: Thanks Dave. When I saw your post, I thought "Duh" - I should've known that - but I've been staring at this code for too long and don't know where I am anymore. I'll try it out. Again, thanks. "Dave Peterson" wrote: Just avoid the hidden sheets. For Each sh In mybook.Worksheets if sh.visible = xlsheetvisible then 'do what you want end if next sh ReportSmith wrote: I currently have code to loop through the number of sheets in a workbook..... Set mybook = Workbooks.Open(MyPath & MyFiles(Fnum)) For Each sh In mybook.Worksheets .....but I need to loop 1 less than the total number of sheets to avoid a hidden sheet in the same workbook - in other words, I need something like..... For Each [sh-1] In mybook.Worksheets.......... Any suggestions? Thanks in advance. -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do i paste rows/columns avoiding hidden rows/columns | Excel Discussion (Misc queries) | |||
I need my Hidden Rows to stay hidden when I print the sheet. | Excel Discussion (Misc queries) | |||
Avoiding sheet deletion by VBA | Excel Programming | |||
how do i copy formula down columns avoiding hidden cells | Excel Discussion (Misc queries) | |||
Saving hidden data with a worksheet (preferably without using a hidden sheet) | Excel Programming |