ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide Sheets to Left Q (https://www.excelbanter.com/excel-programming/444305-hide-sheets-left-q.html)

Seanie

Hide Sheets to Left Q
 
What code could I use to hide all sheets to the "left" of where the
active cell is?

AB[_2_]

Hide Sheets to Left Q
 
try this:
Sub HideLefSheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Index < ActiveSheet.Index Then ws.Visible =
xlSheetHidden
Next ws
End Sub

On Mar 4, 9:28*am, Seanie wrote:
What code could I use to hide all sheets to the "left" of where the
active cell is?



Seanie

Hide Sheets to Left Q
 
On Mar 4, 10:10*am, AB wrote:
try this:
Sub HideLefSheets()
* * Dim ws As Worksheet
* * For Each ws In ThisWorkbook.Worksheets
* * * * If ws.Index < ActiveSheet.Index Then ws.Visible =
xlSheetHidden
* * Next ws
End Sub

On Mar 4, 9:28*am, Seanie wrote:



What code could I use to hide all sheets to the "left" of where the
active cell is?- Hide quoted text -


- Show quoted text -


Perfect, thanks


All times are GMT +1. The time now is 09:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com