Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

hiding sheet based upon

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Hiding a sheet based upon a cell value

Hiding a sheet based upon a cell value

ResolvedVersion 2010

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.

Thu 14 Jan 2016: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Display Formulas Instead of Results in Excel 2010

By pressing Ctrl ~ once, Excel will display formulas rather than the results of the formulas. Press it again, and the results will appear again.

A much quicker and simpler way of displaying your formulas!

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.