Alex has attended:
Excel Advanced course
Hiding a sheet based upon a cell value
Hi,
I am looking to unhide a worksheet that has the same name as a value of a cell in a table. It is part of a larger overall code.
ActiveCell.Offset(0, 14).Select
'I need to get this value to be defined as "sheet"
Sheets("Data").Select
Sheets(sheet).Visible = True
Thanks
RE: Hiding a sheet based upon a cell value
Hi Alex
Your code looks fine
'First define a text variable called sheet
Dim sheet As String
ActiveCell.Offset(0, 14).Select
'Store the value into sheet
sheet = ActiveCell.Value
Sheets("Data").Select
'make visible the worksheet with name stored in sheet
Sheets(sheet).Visible = True
You don't actually have to select the cell containing the sheet name. You can write...
sheet = ActiveCell.Offset(0, 14).Value
as long as the active cell in 14 cells to the left.
Hope that helps for now Alex.
Regards
Doug
Best STL
Will be marked as resolved in 5 days
Notice: This is an automated message. Due to inactivity, this forum post will be marked as 'resolved' if there are no further responses in the next 5 days.