ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macros 2 (https://www.excelbanter.com/excel-programming/425664-macros-2-a.html)

Sri Harsha[_2_]

Macros 2
 
I want to record a macro which hides all the open sheets other than sheet 1.
Can some one tell me how to do that?

Nigel[_2_]

Macros 2
 
Sub HideAll()
Dim wsX As Worksheet
With Worksheets
For Each wsX In Worksheets
If wsX.Name < "Sheet1" Then wsX.Visible = xlSheetHidden
Next
End With
End Sub


--

Regards,
Nigel




"Sri Harsha" wrote in message
...
I want to record a macro which hides all the open sheets other than sheet
1.
Can some one tell me how to do that?



Bob Phillips[_3_]

Macros 2
 
With Activeworkbook

.Worksheets("Sheet1").Visible = xlSheetVisible
For Each sh In .Worksheets

If sh.Name < "Sheet1" Then

sh.Visible = xlSheetHidden
End If
Next sh
End With

--
__________________________________
HTH

Bob

"Sri Harsha" wrote in message
...
I want to record a macro which hides all the open sheets other than sheet
1.
Can some one tell me how to do that?




Jacob Skaria

Macros 2
 
Hi Harsha

Please try the below code.

If this helps click Yes
---------------
Jacob Skaria

Dim intSheets
For intSheets = 1 To ActiveWorkbook.Sheets.Count
If intSheets 1 Then
ActiveWorkbook.Sheets(intSheets).Visible = False
End If
Next



Chip Pearson

Macros 2
 
Try something like

Sub AAA()
Dim N As Long
With ThisWorkbook.Worksheets
For N = 2 To .Count
.Item(N).Visible = False
Next N
End With
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Tue, 17 Mar 2009 04:15:01 -0700, Sri Harsha
wrote:

I want to record a macro which hides all the open sheets other than sheet 1.
Can some one tell me how to do that?



All times are GMT +1. The time now is 05:26 PM.

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