![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Las Vegas Nevada USA
Posts: 240
|
Good Morning All
I have a loop that hides all sheets on closing but will not hide the charts. How do I do this?? Code as follows: Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim a& With Workbooks("Credit Card Recap 1.5") 'Loop through the worksheets For a& = .Worksheets.Count To 2 Step -1 'Hide all but the first worksheet .Worksheets(a&).Visible = xlSheetVeryHidden Next a& End With 'Application.ActiveWorkbook.Save End Sub Have a great day. George |
|
|
|
|
|
#2 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi George
Try: Dim isht As Integer With Workbooks("Credit Card Recap 1.5") 'Loop through the sheets For isht = ActiveWorkbook.Sheets.Count To 2 Step -1 'Hide all but the first worksheet .Sheets(isht).Visible = xlSheetVeryHidden Next sht End with _________________ Kind Regards Dave Hawley OzGrid Business Applications Microsoft Excel/VBA Training If it's Excel, then it's us! [ This Message was edited by: Dave Hawley on 2002-03-11 08:05 ] |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Las Vegas Nevada USA
Posts: 240
|
Thanks Dave. That works well. Have a great day.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|