ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Reducing & increasing tabs on display (https://www.excelbanter.com/excel-worksheet-functions/21477-reducing-increasing-tabs-display.html)

Colin Hayes

Reducing & increasing tabs on display
 

Hi

I have a worksheet with many tabs along the bottom.

To keep the display neat and accessible , and for security reason , I'd
like to sometimes hide / unhide the tabs one-by-one.

I'd like to put 2 buttons one my first page.

One button with each click would hide the last tab in the row one-by-one
, the other button would unhide them one-by-one.

Is this possible?


Grateful for any help

Drno

Gary Brown

Here are the 2 macros, now attach them to buttons.
HTH,
Gary Brown

'/=================================================/
Public Sub HideEm()
Dim i As Long
Dim iWkshtCount As Long

On Error GoTo err_Sub

iWkshtCount = Application.Worksheets.Count

If iWkshtCount 1 Then
For i = iWkshtCount To 1 Step -1
If Worksheets(i).Visible = xlSheetVisible Then
Worksheets(i).Visible = xlSheetHidden
Exit For
End If
Next i
End If

exit_Sub:
Exit Sub

err_Sub:
GoTo exit_Sub

End Sub
'/=================================================/

Public Sub UnhideEm()
Dim i As Long
Dim iWkshtCount As Long

On Error GoTo err_Sub

iWkshtCount = Application.Worksheets.Count

If iWkshtCount 1 Then
For i = 1 To iWkshtCount
'do not process very hidden worksheets
If Worksheets(i).Visible = xlSheetHidden Then
Worksheets(i).Visible = xlSheetVisible
Exit For
End If
Next i
End If

exit_Sub:
Exit Sub

err_Sub:
GoTo exit_Sub

End Sub
'/=================================================/



"Colin Hayes" wrote:


Hi

I have a worksheet with many tabs along the bottom.

To keep the display neat and accessible , and for security reason , I'd
like to sometimes hide / unhide the tabs one-by-one.

I'd like to put 2 buttons one my first page.

One button with each click would hide the last tab in the row one-by-one
, the other button would unhide them one-by-one.

Is this possible?


Grateful for any help

Drno



All times are GMT +1. The time now is 03:55 AM.

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