Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Is it possible to have a macro that hides worksheets based upon text
contained or not contained in the worksheet name? Suppose i have several worksheets but want to hide ony the ones that don't have the text "HOLD" in the name; worksheet names: Data_HOLD Data Selection_HOLD etc.... or maybe base it upon the WS tab color.... Thanks, Joe M. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
This will hide all worksheets with Hold anywhere in the name Sub Hide_shts() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets If InStr(1, ws.Name, "Hold", vbTextCompare) Then ws.Visible = False End If Next End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Joe M." wrote: Is it possible to have a macro that hides worksheets based upon text contained or not contained in the worksheet name? Suppose i have several worksheets but want to hide ony the ones that don't have the text "HOLD" in the name; worksheet names: Data_HOLD Data Selection_HOLD etc.... or maybe base it upon the WS tab color.... Thanks, Joe M. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks. But I have discovered that I will have to rename some other sheets
for this to work and it will affect some macros. What about by the WS tab color? Tis will be easier for me. Sorry for not being sure earlier. Thx, Joe M. "Mike H" wrote: Hi, This will hide all worksheets with Hold anywhere in the name Sub Hide_shts() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets If InStr(1, ws.Name, "Hold", vbTextCompare) Then ws.Visible = False End If Next End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Joe M." wrote: Is it possible to have a macro that hides worksheets based upon text contained or not contained in the worksheet name? Suppose i have several worksheets but want to hide ony the ones that don't have the text "HOLD" in the name; worksheet names: Data_HOLD Data Selection_HOLD etc.... or maybe base it upon the WS tab color.... Thanks, Joe M. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
This will hide sheets with red tabs Sub Hide_shts() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets If ws.Tab.Color = 255 Then ws.Visible = False End If Next End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Joe M." wrote: Thanks. But I have discovered that I will have to rename some other sheets for this to work and it will affect some macros. What about by the WS tab color? Tis will be easier for me. Sorry for not being sure earlier. Thx, Joe M. "Mike H" wrote: Hi, This will hide all worksheets with Hold anywhere in the name Sub Hide_shts() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets If InStr(1, ws.Name, "Hold", vbTextCompare) Then ws.Visible = False End If Next End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Joe M." wrote: Is it possible to have a macro that hides worksheets based upon text contained or not contained in the worksheet name? Suppose i have several worksheets but want to hide ony the ones that don't have the text "HOLD" in the name; worksheet names: Data_HOLD Data Selection_HOLD etc.... or maybe base it upon the WS tab color.... Thanks, Joe M. |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I tried with several WS with red tabs but it only hides one. I double checked
to make sure red was selected. What is wrong? Thanks, Joe M. "Mike H" wrote: Hi, This will hide sheets with red tabs Sub Hide_shts() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets If ws.Tab.Color = 255 Then ws.Visible = False End If Next End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Joe M." wrote: Thanks. But I have discovered that I will have to rename some other sheets for this to work and it will affect some macros. What about by the WS tab color? Tis will be easier for me. Sorry for not being sure earlier. Thx, Joe M. "Mike H" wrote: Hi, This will hide all worksheets with Hold anywhere in the name Sub Hide_shts() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets If InStr(1, ws.Name, "Hold", vbTextCompare) Then ws.Visible = False End If Next End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Joe M." wrote: Is it possible to have a macro that hides worksheets based upon text contained or not contained in the worksheet name? Suppose i have several worksheets but want to hide ony the ones that don't have the text "HOLD" in the name; worksheet names: Data_HOLD Data Selection_HOLD etc.... or maybe base it upon the WS tab color.... Thanks, Joe M. |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to hide sheets based upon cell value | Excel Discussion (Misc queries) | |||
Macro to copy a worksheet and rename based upon text entered in 1 | Excel Discussion (Misc queries) | |||
Macro to Hide rows based on value of column F | Excel Discussion (Misc queries) | |||
Macro to hide and unhide based on criteria | Excel Discussion (Misc queries) | |||
Formula or Macro to hide a row based on a cell value | Excel Discussion (Misc queries) |