Computing.Net > Forums > Office Software > Reference to Sheet Name for Dynamic Button

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Reference to Sheet Name for Dynamic Button

Reply to Message Icon

Name: mworonuk
Date: August 26, 2009 at 08:23:14 Pacific
OS: Windows XP
Product: Microsoft Excel 2007
Subcategory: General
Tags: vba, excel, Dynamic Reference, Button
Comment:

Hi,

Background Information:
I am creating a DASHBOARD sheet to be at the beginning of my workbook with multiple sheets.

In DASHBOARD I have created a chart that contains client analysis formulas that reference to the appropriate client sheet name in the same workbook by reference to Cell C8. To do this, in each statistics formula I have used the Indirect reference: =INDIRECT("'" & C8 &"'!G3")

My next step is to make a dynamic button that also uses Cell C8 as the sheet name to jump to. AKA: I want the "Go" button to jump the user exactly to the client sheet which is named in cell C8.

I have used this simple VBA to use a button to jump to a sheet name:

Private Sub Client_Click()

Sheets("Client-Template").Select

End Sub

I need help to make the sheet reference dynamically linked to the contents of Cell C8 which will have the exact worksheet name of any of the clients:
The following is my failed attempt to create a dynamic variable that depended on Cell C8
Private Sub Client_Click()
Client as String

Client = Range(C8)
Sheets("Client").Select

End Sub

Thank you for any and all of your help!



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: August 26, 2009 at 08:33:36 Pacific
Reply:

Just fixing some syntax errors - mainly misplaced quotes:

Private Sub Client_Click()
Dim Client As String
 Client = Range("C8")
 Sheets(Client).Select
End Sub

or, simply

Private Sub Client_Click()
  Sheets(Range("C8").Value).Select
End Sub


0

Response Number 2
Name: mworonuk
Date: August 27, 2009 at 11:48:45 Pacific
Reply:

Thank you so much! I knew I had been missing something in the syntax.

I applied the second, more simple approach and it works like a dream. This is a small but major addition in functionality.

I now have a dynamic jump button, this is probably very useful to any one else with workbooks that have many sheets and use a dashboard summary to manage data.

Thanks again DerbyDad03!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Reference to Sheet Name for Dynamic Button

dragging formula with a sheet name www.computing.net/answers/office/dragging-formula-with-a-sheet-name/8881.html

Conditional Formatting 1 www.computing.net/answers/office/conditional-formatting-1/9447.html

Password for Command Button www.computing.net/answers/office/password-for-command-button/6317.html