View difference between Paste ID: vBDzLpNR and qaq4LEse
SHOW: | | - or go back to the newest paste.
1
Private Sub DropDown2_Initialize()
2
    Me.DropDown2.AddItem ("all")
3
    With DropDown2
4
        Dim year_counter As Integer
5
        For year_counter = 2012 To 2025
6
            .AddItem (year_counter)
7
        Next year_counter
8
    End With
9
End Sub
10
11
12
Sub DropDown2_Change()
13
14
    Call hideAllMonthlySheets
15
16
        If DropDown2.Value = "all" Then
17
            Call showAllMonthlySheets
18
        ElseIf DropDown2.Value > 2000 Then
19
            For month_counter = 1 To 12
20
               Sheets("subtotals-" + DropDown2.Value + "-" + month_counter).Visible = xlSheetVisible
21
            Next month_counter
22
       End If
23
24
    End With
25
End Sub
26
27
Sub showAllMonthlySheets()
28
    Dim year_counter As Integer
29
    For year_counter = 2012 To 2025
30
        Dim month_counter As Integer
31
        For month_counter = 1 To 12
32
            Sheets("subtotals-" + year_counter + "-" + month_counter).Visible = xlSheetVisible
33
        Next month_counter
34
    Next year_counter
35
End Sub
36
37
38
Sub hideAllMonthlySheets()
39
    Dim year_counter As Integer
40
    For year_counter = 2012 To 2025
41
        Dim month_counter As Integer
42
        For month_counter = 1 To 12
43
            Sheets("subtotals-" + DropDown2.Value + "-" + month_counter).Visible = xlSheetHidden
44
        Next month_counter
45
    Next year_counter
46
47
End Sub