Quote Originally Posted by Aland2929 View Post
Hi Guys,

I have a userform from which I choose one of 12 months. Based on the month selected I want to run the following code: This is an extract of the code. My problem is with the second line of code. Please help?
Thank You


Dim DataChosen As Integer
    Date = ListBox1.Value
    
    Select Case Date
    
        Case "January"
        With ActiveSheet.PivotTables("CommissionData").PivotFields("Month")
            .PivotItems("January").Visible = True
        End With
        
        Case "February"
        With ActiveSheet.PivotTables("CommissionData").PivotFields("Month")
            .PivotItems("January").Visible = True
            .PivotItems("February").Visible = True
        End With
There was a spelling mistake which I have corrected. I have change the code but still have a problem with the DateChosen line?
Dim DateChosen As Integer
    DateChosen = ListBox1.Value
    
    Select Case DateChosen
Thank You