ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro that unhides sheet tabs (https://www.excelbanter.com/excel-discussion-misc-queries/191254-macro-unhides-sheet-tabs.html)

Sunnyskies

Macro that unhides sheet tabs
 
Hi from Sunny RSA,

Looking for a macro that once a cell is selected (D5) then a tab called the
same as cell D5 unhides itself.

Thanks

Don Guillett

Macro that unhides sheet tabs
 
Right click sheet tabview codecopy/paste this. If sheet2 is hidden and
sheet2 is typed into the cell and you then select that cell sheet2 will be
visible

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
Sheets(CStr(Target)).Visible = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Sunnyskies" wrote in message
...
Hi from Sunny RSA,

Looking for a macro that once a cell is selected (D5) then a tab called
the
same as cell D5 unhides itself.

Thanks



Otto Moehrbach[_2_]

Macro that unhides sheet tabs
 
Surely you don't want this to work on just one cell (D5). I'll assume you
want this to work on D5:F10. The following macro will do what you want
whenever any cell in the range D5:F10 is selected. Note that this macro
must be placed in the sheet module of the sheet that holds the D5:F10 sheet
names. To access that module, right-click on the sheet tab, select View
Code, and paste this macro into that module. "X" out of the module to
return to your sheet. HTH Otto
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("D5:F10")) Is Nothing Then
Sheets(Target.Value).Visible = True
End If
End Sub
"Sunnyskies" wrote in message
...
Hi from Sunny RSA,

Looking for a macro that once a cell is selected (D5) then a tab called
the
same as cell D5 unhides itself.

Thanks




Mike H

Macro that unhides sheet tabs
 
Maybe this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Target.Address = "$D$5" Then
On Error Resume Next
Application.EnableEvents = False
Sheets(Target.Text).Visible = True
Application.EnableEvents = True
On Error GoTo 0
End If
End Sub

Mike

"Sunnyskies" wrote:

Hi from Sunny RSA,

Looking for a macro that once a cell is selected (D5) then a tab called the
same as cell D5 unhides itself.

Thanks


Dave

Macro that unhides sheet tabs
 
Hi,
Try this, entered onto the VBA sheet window - the same sheet as the D5
thingy is on.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Target.Address = Range("D5").Address Then
Sheets(Range("D5").Value).Visible = True
End If
End Sub

Regards - Dave.


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

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