Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I know how to hide worksheets using VBA but I am unsure how to hide all
the worksheets in a workbook except for a specific one. The name of this worksheet will never change. Any ideas? I would appreciate any help. Thank you, |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim ws as Worksheet
for each ws in Worksheets if ws.name<"Sheet1" then ws.Hide end if nxt ws HTH -- AP "Kris" a écrit dans le message de news: ... I know how to hide worksheets using VBA but I am unsure how to hide all the worksheets in a workbook except for a specific one. The name of this worksheet will never change. Any ideas? I would appreciate any help. Thank you, |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
for each ws in worksheets
if ws.name<"myname" then ........... next ws -- Don Guillett SalesAid Software "Kris" wrote in message oups.com... I know how to hide worksheets using VBA but I am unsure how to hide all the worksheets in a workbook except for a specific one. The name of this worksheet will never change. Any ideas? I would appreciate any help. Thank you, |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have tried to modify this so it hides all but Sheet1 however it is
not working. Any advice? Sub Hide() Dim ws As Worksheet For Each ws In Worksheets If ws.Name < ("Sheet1") Then Else ws.Hide End If nxt ws End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sub hidebut()
for each ws in worksheets if ws.name<"Sheet1" then ws.Visible = False next ws end sub -- Don Guillett SalesAid Software "Kris" wrote in message oups.com... I have tried to modify this so it hides all but Sheet1 however it is not working. Any advice? Sub Hide() Dim ws As Worksheet For Each ws In Worksheets If ws.Name < ("Sheet1") Then Else ws.Hide End If nxt ws End Sub |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This still doesn't help me as I have macro's that will do Sheet A - Z
depending on certain variables and then Sheet1. I want to hide all Sheets a-z (Currently I have SheetA - Sheet D but tomorrow the Macro could add SheetE and I don't want to have to modify the code just because it added a sheet.) Thanks for the continued help. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The suggested code by Ardus and Don do exactly that. They hide all sheets
except a sheet named Sheet1 regardless of how many other sheets there are. the suggested code needed no adjustment. Your ill-advised adjustment to Ardus' code insured it would not work. In fact you changed it so only sheet1 would be hidden. -- Regards, Tom Ogilvy "Kris" wrote: This still doesn't help me as I have macro's that will do Sheet A - Z depending on certain variables and then Sheet1. I want to hide all Sheets a-z (Currently I have SheetA - Sheet D but tomorrow the Macro could add SheetE and I don't want to have to modify the code just because it added a sheet.) Thanks for the continued help. |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I don't know why I wasn't understanding, I am just thick. I was looking
for the does not equal operator trying != and all sorts of wild things. < is does not equal. Wow I am slow. Thanks everyone for the help. |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having some syntax issue trying to modify this script now. I am
missing something completly obvious can one of you help. (The reasoning behind this is that when closing the workbook it will save itself twice each time it saves different sheets will be hidden so that when people open each workbook only the information they need will be shown.) Here is my code. Sub hidebut() For Each ws In Worksheets If Active.Workbook = "abefrof.xls" Then If ws.Name < "Solution Direct Tracking" Then ws.Visible = True Next ws If Active.Workbook = "abetest1.xls" Then If ws.Name < "Solution Direct Tracking" Then ws.Visible = False Next ws End Sub Thanks for all the help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hide a specific number in a cell | Excel Discussion (Misc queries) | |||
hide specific cells in Excel | Excel Worksheet Functions | |||
print specific worksheets in specific order. | Excel Programming | |||
Hide all rows where one specific cell in that row = 0? | Excel Discussion (Misc queries) | |||
hide rows with specific contents | Excel Programming |