ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide/Unhide sheets (https://www.excelbanter.com/excel-programming/286822-hide-unhide-sheets.html)

[email protected]

Hide/Unhide sheets
 
Is it possible to hide and unhide sheets thru VBA?

Thnks



Roger Govier[_2_]

Hide/Unhide sheets
 
Hi Dave

Try
Sheets("Sheet1").Visible = False
..
..
..
Sheets("Sheet1").Visible = True

--
Regards
Roger Govier
" wrote in
message ...
Is it possible to hide and unhide sheets thru VBA?

Thnks





[email protected]

Hide/Unhide sheets
 
Thnks

"Roger Govier" wrote in message
...
Hi Dave

Try
Sheets("Sheet1").Visible = False
.
.
.
Sheets("Sheet1").Visible = True

--
Regards
Roger Govier
" wrote in
message ...
Is it possible to hide and unhide sheets thru VBA?

Thnks







Tom Ogilvy

Hide/Unhide sheets
 
Public Sub Hidesheets()
Dim sh as Worksheet
for each sh in thisworkbook.worksheets
if sh.Name < "Sheet1" then
sh.visible = xlSheetHidden
else
sh.Visible = xlSheetVisible
end if
Next
End Sub


as an example.
--
Regards,
Tom Ogilvy

wrote in message
...
Is it possible to hide and unhide sheets thru VBA?

Thnks





Tom Ogilvy

Hide/Unhide sheets
 
Just to add, the acceptable constants a

? xlSheetVisible
-1
? xlSheetHidden
0
? xlSheetVeryHidden
2

True is coerced to -1
False is coerced to 0

so they work as well.

--
Regards,
Tom Ogilvy


Roger Govier wrote in message
...
Hi Dave

Try
Sheets("Sheet1").Visible = False
.
.
.
Sheets("Sheet1").Visible = True

--
Regards
Roger Govier
" wrote in
message ...
Is it possible to hide and unhide sheets thru VBA?

Thnks








All times are GMT +1. The time now is 12:23 PM.

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