![]() |
All Sheets Unhide and Select
Question 1:
We are missing the visual basic code for selecting all sheets in the workbook without having specific names for all the sheets. Question 2: We want to unhide all hidden sheets in the workbook without specifying specific names of them with one line of code. We have achieved this with for next already but not with a specific code line. For Each sh In Sheets sh.Visible = True Next sh |
All Sheets Unhide and Select
For your first question, use
Worksheets.Select For your second question, you need to use the For Next loop. There isn't a single line of code for unhiding all worksheets. -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com "Hande & Tolga" wrote in message ... Question 1: We are missing the visual basic code for selecting all sheets in the workbook without having specific names for all the sheets. Question 2: We want to unhide all hidden sheets in the workbook without specifying specific names of them with one line of code. We have achieved this with for next already but not with a specific code line. For Each sh In Sheets sh.Visible = True Next sh |
All Sheets Unhide and Select
Sub Q1()
Dim wsArray() As String Dim ws As Worksheet Dim index As Long ReDim wsArray(1 To Worksheets.Count) For index = 1 To Worksheets.Count wsArray(index) = Worksheets(index).Name Next Sheets(wsArray).Select Sheets("Sheet6").Activate End Sub Sub Q2() Dim ws As Worksheet For Each ws In Worksheets ws.Visible = xlSheetVisible Next End Sub Patrick Molloy Microsoft Excel MVP -----Original Message----- Question 1: We are missing the visual basic code for selecting all sheets in the workbook without having specific names for all the sheets. Question 2: We want to unhide all hidden sheets in the workbook without specifying specific names of them with one line of code. We have achieved this with for next already but not with a specific code line. For Each sh In Sheets sh.Visible = True Next sh . |
All times are GMT +1. The time now is 06:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com