-
VBA to Hide/Unhide Sheets
Sadly XL on Mac does not appear to allow keyboard shortcuts for Hide Worksheet (on Windows ALT + O + H + H) nor for Unhide Worksheet (ALT + O + H + U). And even in the Customize toolbar there doesn't seem to be any way to access these two commands (Format > Sheet > Hide/Unhide).
So, VBA code seems to be the way to go. It is simple to Hide the activesheet as follows. which then can be assigned to a keyboard shortcut.
[VBA]Sub HideSheet()
ActiveWindow.SelectedSheets.Visible = False
End Sub[/vba]
With Unhide it isn't as easy. I am having trouble unhiding, not being able to bring up the dialog box that lists the worksheets that are hidden. This is my initial attempt; it brings up a list of hidden worksheets, and then the person can type in that name. I suppose I could develop a UserForm, but UF can be a pain in XL on the Mac (from my experience).
[vba]
Sub UnHideSheet()
Dim ws As Worksheet
Dim myList As String
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible = False Then
myList = ws.Name
MsgBox myList
End If
Next ws
Dim mySht As String
mySht = InputBox("What Sheet do you want to unhide?")
Sheets(mySht).Visible = True
End Sub
[/VBA]
Anyone have any other ideas?
Software: LibreOffice 3.3 on Mac OS X 10.6.5
(retired Excel 2003 user, 3.28.2008
)
Humanware: Older than dirt
--------------------
old, slow, and confused
but at least I'm inconsistent! 
Rich
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules