Private worksheet change with multiple cell value triggers

kwdennis

New Member
Joined
Jun 6, 2019
Messages
15
Cell C3 sets how many characters to display All, by 5, or by10
Cell C5 and or cell C7 shows a range of those characters by 5 or by 10 groups
Cell C9 sets how many sagas to show All, or a specific saga

The macros that I am firing are simply hide and unhide cells and or rows as need

Once I try to select a saga it resets to show all characters each time. I have tried several approaches to correct this but have been unsuccessful so far any help would be appreciated.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Worksheets("A_Heroic_Saga").Range("A:CZ").EntireColumn.AutoFit

    If Not Intersect(Target, Range("C3")) Is Nothing Then
    
        Select Case Target.Value
       
            Case "Show All"
                Call DisplayAllCharacters

            Case "Display 5"
                Call DisplayFiveCharacters

            Case "Display 10"
                Call DisplayTenCharacters

        End Select
    End If

    If Not Intersect(Target, Range("C5")) Is Nothing Then
    
        Select Case Target.Value
        
            Case "1-5"
                Call Display1to5
            Case "6-10"
                Call Display6to10
            Case "11-15"
                Call Display11to15
            Case "16-20"
                Call Display16to20
            Case "21-25"
                Call Display21to25
            Case "26-30"
                Call Display26to30
            Case "31-35"
                Call Display31to35
            Case "36-40"
                Call Display36to40
            Case "41-45"
                Call Display41to45
            Case "46-50"
                Call Display46to50
                
        End Select
    End If
    
    If Not Intersect(Target, Range("C7")) Is Nothing Then
    
        Select Case Target.Value
        
            Case "1-10"
                Call Display1to10
            Case "11-20"
                Call Display11to20
            Case "21-30"
                Call Display21to30
            Case "31-40"
                Call Display31to40
            Case "41-50"
                Call Display41to50
                
        End Select
    End If
    
    If Not Intersect(Target, Range("C9")) Is Nothing Then

        Select Case Target.Value
        
            Case "Display All"
                Call DisplayAllHeroicSagas
               
            Case "Thunder Sea"
                Call DisplayHeroicThunderSea
               
            Case "Ravenloft"
                Call DisplayHeroicRavenloft
               
            Case "Gianthold"
                Call DisplayHeroicGianthold
                
            Case "Sharn"
                Call DisplayHeroicSharn
               
            Case "The Cogs"
                Call DisplayHeroicTheCogs
                
            Case "Huntsilver"
                Call DisplayHeroicHuntsilver
                
            Case "Cormyr"
                Call DisplayHeroicCormyr

        End Select
    End If
End Sub
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
The method I always use
- trigger hides EVERYTHING
- use code to unhide ONLY what should be visible

Is that what you are doing?
 
Upvote 0

Forum statistics

Threads
1,223,992
Messages
6,175,829
Members
452,673
Latest member
LaMiaAvy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top