+ Reply to Thread
Results 1 to 9 of 9

Change Sheet tab from multiple Cell Values (Help FIX)

Hybrid View

  1. #1
    Registered User
    Join Date
    02-16-2015
    Location
    Australia
    MS-Off Ver
    2012 on mac
    Posts
    38

    Question Change Sheet tab from multiple Cell Values (Help FIX)

    Hey Guys again i have a macro that changes worksheets (tabs) based on cell value. I have it working correct for one cell (B2) but i need 3 cells (B2, F2, M2) that i can type the sheet name in on the first sheet and it directs to the sheet could someone explain how i would add those cells to my code? Thanks for all the help.

    MODULE:
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$B$2" Then
    Call Go_To_Tab_0
    End If
    End Sub
    Sheet Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$B$2" Then
    Call Go_To_Tab_0
    End If
    End Sub

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Change Sheet tab from multiple Cell Values (Help FIX)

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Union(Range("B2"), Range("F2"), Range("M2"))) Is Nothing Then
    Call Go_To_Tab_0
    End If
    End Sub

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Change Sheet tab from multiple Cell Values (Help FIX)

    Perhaps.
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Range("B2,F2,M2")) Is Nothing Then
            Call Go_To_Tab_0
        End If
    End Sub
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    02-16-2015
    Location
    Australia
    MS-Off Ver
    2012 on mac
    Posts
    38

    Re: Change Sheet tab from multiple Cell Values (Help FIX)

    Thanks Guys they both worked perfectly.

  5. #5
    Registered User
    Join Date
    02-16-2015
    Location
    Australia
    MS-Off Ver
    2012 on mac
    Posts
    38

    Re: Change Sheet tab from multiple Cell Values (Help FIX)

    Thanks Guys ill give these a try.

  6. #6
    Registered User
    Join Date
    02-16-2015
    Location
    Australia
    MS-Off Ver
    2012 on mac
    Posts
    38

    Re: Change Sheet tab from multiple Cell Values (Help FIX)

    Hi again i just realized today that i still have an issue, I have 2 two cells i can type a sheet name into G10 and H10, But if i have sheet4 written in G10 and a type a new name into H10 it say sheet6 it will still go to sheet4 here is my code again for my Module and Sheet.

    Module
    Sub Go_To_Tab_0()
    Dim strWsName As String
    strWsName = Sheet1.Range("$G$10")
    Sheets(strWsNme).Select
    End Sub
    l
    Sheet
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Union(Range("G10"), Range("H10"))) Is Nothing Then
    Call Go_To_Tab_0
    End If
    End Sub
    Thanks

  7. #7
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Change Sheet tab from multiple Cell Values (Help FIX)

    Sheet1.Range("G10") and Sheets("Sheet1").Range("G10") are completely different and could be 2 entirely different sheets/ranges. Research sheet index number for some more clarification.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Change Sheet tab from multiple Cell Values (Help FIX)

    Also, where do Sheet4 and Sheet come into it?

  9. #9
    Registered User
    Join Date
    02-16-2015
    Location
    Australia
    MS-Off Ver
    2012 on mac
    Posts
    38

    Re: Change Sheet tab from multiple Cell Values (Help FIX)

    Okay here is an example i have two drop downs, One drop down contains sheets 1 through 5 and the second drop down contains sheets 6-10. Just think of it as the first drop down only shows Fruits and the second only shows Veggies. Ive been watching a few videos i knew nothing about macros till a week ago and just learning. I uploaded an example sheet, But thanks for the help

    Workbook2.xls

+ 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. Change Cell if One of Multiple Values (VBA)
    By gema in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-28-2012, 02:50 PM
  2. Replies: 2
    Last Post: 06-04-2012, 06:57 AM
  3. Change multiple cell values at once?
    By rbpd5015 in forum Excel General
    Replies: 0
    Last Post: 08-04-2010, 04:35 PM
  4. How to change change multiple cell values at once?
    By larryg003 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-29-2010, 10:19 PM
  5. Is it possible to change multiple cell values at once?
    By deeppurple247 in forum Excel General
    Replies: 3
    Last Post: 02-18-2007, 01:23 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