![]() |
Hide All Worksheets Except Specific
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, |
Hide All Worksheets Except Specific
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, |
Hide All Worksheets Except Specific
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, |
Hide All Worksheets Except Specific
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 |
Hide All Worksheets Except Specific
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 |
Hide All Worksheets Except Specific
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. |
Hide All Worksheets Except Specific
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. |
Hide All Worksheets Except Specific
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. |
Hide All Worksheets Except Specific
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 |
All times are GMT +1. The time now is 11:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com