Open hidden sheet from a cell that has variable input values

russelldt

Board Regular
Joined
Feb 27, 2021
Messages
160
Office Version
  1. 365
Platform
  1. MacOS
Morning,

I have 3 cells on a sheet (C18,D18, E18), that contain variable values, depending on selections made elsewhere on the sheet. The value that is shown on each of the 3 cells, are the names of hidden sheets. I want to be able to unhide the sheet(s) by selecting the relevant cell (C18, D18 or E18).

I have been using the following VBA, but for some reason it's no longer working. I'm using Excel version 16.71.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
If Not Intersect(Target, Range("C18, D18, E18")) Is Nothing Then Worksheets(Target.Value).Visible = xlSheetVisible
Application.EnableEvents = True
End sub


Any help to resolve this would be appreciated.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
May not be a great help but it works on my Windows 10 machine running 365 Version:2302 Build:16130.20306 Click-to-Run
 
Upvote 0
May not be a great help but it works on my Windows 10 machine running 365 Version:2302 Build:16130.20306 Click-to-Run
Ta, I'm on Mac OS, so that could be the issue, although I don't know why, as it has worked for a few years.
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top