Home |
Search |
Today's Posts |
#1
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the help. I must be doing something wrong. When I run this
script it gives me an error and highlights this line: For Each ws In Workbooks("abefrof.xls").Worksheets I think it is because I don't have this workbook open. What I am trying to do is run the macro one way if the name is one thing and a different way if the workbook name is another. Only one is open at a time. Can you help me figure out what I did wrong? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is your original code, with syntax errors corrected
'--------------- Sub hidebut() Dim ws As Worksheet For Each ws In Worksheets If ActiveWorkbook.Name = "abefrof.xls" Then If ws.Name < "Solution Direct Tracking" Then ws.Visible = True End If End If If ActiveWorkbook.Name = "abetest1.xls" Then If ws.Name < "Solution Direct Tracking" Then ws.Visible = False End If End If Next ws End Sub '-------------- "Kris" a écrit dans le message de news: ... 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 | |||
Hiding Sheets in workbook - help | Excel Discussion (Misc queries) | |||
hiding rows depending on the date | Excel Discussion (Misc queries) | |||
Hiding named ranges depending on a cell value | Excel Programming | |||
Hiding sheets within a workbook | Charts and Charting in Excel | |||
hiding a control depending on a cell's value | Excel Programming |