+ Reply to Thread
Results 1 to 12 of 12

Button which links the front page to another page depending on a data validation cell valu

  1. #1
    Registered User
    Join Date
    02-10-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    31

    Button which links the front page to another page depending on a data validation cell valu

    I'd like to create a button which would sit on the first sheet of my workbook. This button would link to other sheets in the workbook depending on the data validation value of another cell in the front worksheet.
    ie. Cell B2 in sheet 1 has a data validation with the following list array: Ballarat, Brunswick, Canberra, Geelong, Gosford, Sydney. If cell B2 contains the value Brunswick, then it will open sheet 2 (named Ballarat), if B2 contains Sydney it will open sheet 6.
    Is this possible or do I need to go about it another way?

  2. #2
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Oklahoma
    MS-Off Ver
    Office 2007 / Office 2010
    Posts
    123

    Re: Button which links the front page to another page depending on a data validation cell

    You could use a select case statement based on the value of your cell.

  3. #3
    Registered User
    Join Date
    02-10-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Button which links the front page to another page depending on a data validation cell

    Thank you Yrean,
    If i understand this correctly (having done some research), the vba would look something like this:

    Select Case Activesheet.Range("B2").Value
    Case Ballarat
    'Select Ballarat
    Sheets("Ballarat").Select
    .
    .
    .
    Case Sydney
    'Select Sydney
    Sheets("Sydney").Select
    End Select

    Would this be correct?
    This is my 1st time writing vba.

  4. #4
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Oklahoma
    MS-Off Ver
    Office 2007 / Office 2010
    Posts
    123

    Re: Button which links the front page to another page depending on a data validation cell

    Yes. Just be sure to include the quotations in the case line:

    Please Login or Register  to view this content.
    Another option is if the cell value will always be the sheet name then just use:
    Please Login or Register  to view this content.
    Last edited by Yraen; 02-10-2013 at 10:45 AM. Reason: added an option

  5. #5
    Registered User
    Join Date
    02-10-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Button which links the front page to another page depending on a data validation cell

    I've received an error message which says Complile Error: Invalid outside procedure.
    Am I missing some code or have I mis-named something?

  6. #6
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Oklahoma
    MS-Off Ver
    Office 2007 / Office 2010
    Posts
    123

    Re: Button which links the front page to another page depending on a data validation cell

    Unknown. If you'll post your code or workbook I'll write it up real quick. Best way is to post the workbook, but I understand that sometimes they have data we cannot or do not want to share.

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Button which links the front page to another page depending on a data validation cell

    Hello greg19,

    Maybe the attached WorkBook is what you are looking for?

    Also see the "Please consider" note at the bottom of this post.
    Attached Files Attached Files
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  8. #8
    Registered User
    Join Date
    02-10-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    31

    Red face Re: Button which links the front page to another page depending on a data validation cell

    Hi Yraen,
    Thanks again for your assistance.
    My VBA code is:
    Select Case Dashboard.Range("C6").Value
    Case "Brunswick"
    'Select Jenny + Gemma
    Sheets("Jenny + Gemma").Select
    Case "Ballarat"
    'Select Cheryl + Leigh
    Sheets("Cheryl + Leigh").Select
    Case "Sydney"
    'Select Imranm + Mark
    Sheets("Imran + Mark").Select
    Case "ACT"
    'Select Craig + Josh
    Sheets("Craig + Josh").Select
    Case "Gosford"
    'Select Stuart + Ben
    Sheets("Stuart + Ben").Select
    Case "Coffs Harbour"
    'Select Jacob + Martina
    Sheets("Jacob + Martina").Select
    End Select

    The sheets are:
    Sheet1 (Jenny + Gemma)
    Sheet2 (Dashboard) - this is my front page with data validation in cell C6
    Sheet3 (Cheryl + Leigh)
    Sheet4 (Imran + Mark)
    Sheet5 (Craig + Josh)
    Sheet6 (Stuart + Ben)
    Sheet7 (Jacob + Martina)

    My system won't let me attach the whole workbook
    Thanks again.

    Hi Winon,
    I'm afraid I had a little trouble working out your solution.
    But thankyou and I appreciate your suggestion re "Please Consider"

  9. #9
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Button which links the front page to another page depending on a data validation cell

    Hello greg19,

    Thank you for your feedback.

    O.K. Let us try again, and let me know if the revised attached WorkBook, does it for you?
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    02-10-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Button which links the front page to another page depending on a data validation cell

    Hi Winon,
    Thats perfect.
    Thankyou

  11. #11
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Oklahoma
    MS-Off Ver
    Office 2007 / Office 2010
    Posts
    123

    Re: Button which links the front page to another page depending on a data validation cell

    Glad you got it worked out. Sorry I didn't make it back here quicker.

  12. #12
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Button which links the front page to another page depending on a data validation cell

    Hello greg19,

    You are welcome.

    Thank you for the Rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1