Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Question about For Each ws in Worksheets
I have a reporting program I wrote on Excel. Basically, what it does is
generate reports for accounting purposes based on activity. I have a sheet I want hidden, as no one needs it but me for data validation. Here is a snippet of my macro: Private Sub Test() For Each ws in Worksheets ws.Activate [actions] End Sub My question is in the ws.Activate line: Using this line, will it activate my hidden sheet? If so, I can work around that. Thanks. -- I am running on Excel 2003, unless otherwise stated. Please rate posts so we know when we have answered your questions. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Question about For Each ws in Worksheets
Never mind. It does activate hidden sheets. I added to my workaround and my
program works fine now. -- I am running on Excel 2003, unless otherwise stated. Please rate posts so we know when we have answered your questions. Thanks. "Orion Cochrane" wrote: I have a reporting program I wrote on Excel. Basically, what it does is generate reports for accounting purposes based on activity. I have a sheet I want hidden, as no one needs it but me for data validation. Here is a snippet of my macro: Private Sub Test() For Each ws in Worksheets ws.Activate [actions] End Sub My question is in the ws.Activate line: Using this line, will it activate my hidden sheet? If so, I can work around that. Thanks. -- I am running on Excel 2003, unless otherwise stated. Please rate posts so we know when we have answered your questions. Thanks. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Question about For Each ws in Worksheets
You could try this. I do agree with Don, I wouldn't think it is neccessary
to activate each sheet to do the actions. It may make your code more efficient. ' this will exclude the named worksheet Private Sub Test() For Each ws in Worksheets If Not ws.Name Is "Hidden Sheet Name" Then ws.Activate [actions] End If Next ws End Sub or ' this will exclude all hidden worksheets Private Sub Test() For Each ws in Worksheets If Not ws.Visible = False Then ws.Activate [actions] End If Next ws End Sub -- Cheers, Ryan "Orion Cochrane" wrote: I have a reporting program I wrote on Excel. Basically, what it does is generate reports for accounting purposes based on activity. I have a sheet I want hidden, as no one needs it but me for data validation. Here is a snippet of my macro: Private Sub Test() For Each ws in Worksheets ws.Activate [actions] End Sub My question is in the ws.Activate line: Using this line, will it activate my hidden sheet? If so, I can work around that. Thanks. -- I am running on Excel 2003, unless otherwise stated. Please rate posts so we know when we have answered your questions. Thanks. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Question about For Each ws in Worksheets
I like that second example excluding the hidden sheets. There was only one
hidden sheet in my actual program, and the sheet name was short, so I excluded that sheet. Thanks, though. I am sure I will need that example elsewhere. -- I am running on Excel 2003, unless otherwise stated. Please rate posts so we know when we have answered your questions. Thanks. "RyanH" wrote: You could try this. I do agree with Don, I wouldn't think it is neccessary to activate each sheet to do the actions. It may make your code more efficient. ' this will exclude the named worksheet Private Sub Test() For Each ws in Worksheets If Not ws.Name Is "Hidden Sheet Name" Then ws.Activate [actions] End If Next ws End Sub or ' this will exclude all hidden worksheets Private Sub Test() For Each ws in Worksheets If Not ws.Visible = False Then ws.Activate [actions] End If Next ws End Sub -- Cheers, Ryan "Orion Cochrane" wrote: I have a reporting program I wrote on Excel. Basically, what it does is generate reports for accounting purposes based on activity. I have a sheet I want hidden, as no one needs it but me for data validation. Here is a snippet of my macro: Private Sub Test() For Each ws in Worksheets ws.Activate [actions] End Sub My question is in the ws.Activate line: Using this line, will it activate my hidden sheet? If so, I can work around that. Thanks. -- I am running on Excel 2003, unless otherwise stated. Please rate posts so we know when we have answered your questions. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Linking Worksheets question | Excel Discussion (Misc queries) | |||
VBA question about selecting worksheets | Excel Discussion (Misc queries) | |||
Question : Workbooks or Worksheets? | Excel Worksheet Functions | |||
Help! Question about Worksheets.Copy | Excel Programming | |||
Question about worksheets in an AddIn | Excel Programming |