#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default 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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default 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?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros in Personal.xls that would create two toolbars and buttonswith assigned macros Brian Day Excel Programming 1 March 29th 07 11:20 PM
choose default macros Not Enabled / Macros Enable Setting BEEJAY Excel Programming 2 June 30th 06 01:07 PM
weird saving of a document with macros resulting with macros being transfered to the copy alfonso gonzales Excel Programming 0 December 12th 04 09:19 PM
Macros inside macros, and pasting into macro code. pagelocator[_2_] Excel Programming 1 November 24th 04 09:11 AM
convert lotus 123w macros to excel macros rpiescik[_2_] Excel Programming 1 September 19th 04 12:41 PM


All times are GMT +1. The time now is 02:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"