+ Reply to Thread
Results 1 to 4 of 4

vba codes to show sheet/tab based on data validation

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-09-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    235

    vba codes to show sheet/tab based on data validation

    Hi guys,

    is there any vba codes that can show tab/sheet that is based on the filter selection.

    for example:

    Cell A1 have a data validation of Apple, orange and Mango

    i have 3 tabs named Apple, orange and Mango.

    so everytime i select Apple on the MAin page filter. Apple tab will show. and if orange then orange tab will show.

    thanks.

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: vba codes to show sheet/tab based on data validation

    Here is a quick macro to place on Sheet1. I assume that the other three sheets are sheets 2 thru 4 and named as you have suggested.

    This macro allows you to delete your selection, or go to the nominated sheet.

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
        
        If Target.Address = "$A$1" Then
            If Target.Value = "" Then
                Sheets("Sheet1").Select
                Exit Sub
            End If
            sht = Target.Value
            Sheets(sht).Select
        End If
        
    End Sub
    I hope this helps, please let me know!

    Regards,

    David

    When you reply please make it clear WHO you are responding to by mentioning their name.

    If this has been of assistance, please advise. A little thanks goes a long way.
    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

  3. #3
    Forum Contributor
    Join Date
    03-09-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    235

    Re: vba codes to show sheet/tab based on data validation

    Hi David,
    Thanks for the code but how can do if the sheet name are apple, orange and mango?

    thanks again

  4. #4
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: vba codes to show sheet/tab based on data validation

    Quote Originally Posted by albert28 View Post
    Hi David,
    Thanks for the code but how can do if the sheet name are apple, orange and mango?

    thanks again
    Hi Albert,

    You said that you had a drop down list (using data validation). I assumed this was NOT on one of the sheets Apple, Orange or Mango.

    If not, just take out the IF statement on lines 3 to 6, and paste the code on the three sheets.

    This seems like a waste of effort to me! It is easier to just click the Tab you want!

    Regards,

    David

    When you reply please make it clear WHO you are responding to by mentioning their name.

    If this has been of assistance, please advise. A little thanks goes a long way.
    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Formula to display data validation results on another sheet based on data chosen?
    By myoung5149 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-16-2013, 02:53 PM
  2. Replies: 3
    Last Post: 09-25-2013, 10:42 PM
  3. Replies: 0
    Last Post: 07-10-2013, 10:54 AM
  4. Only show data based on filtering from other sheet
    By D-smoke in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-25-2012, 04:40 AM
  5. Replies: 1
    Last Post: 06-23-2005, 07:05 PM

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