View difference between Paste ID: qaq4LEse and 8vSZBrnz
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-
    hideAllMonthlySheets
13+
14
    Call hideAllMonthlySheets
15
16-
            showAllMonthlySheets
16+
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-
            Sheets("subtotals-" + DropDown2.Value + "-" + month_counter).Visible = xlSheetVisible
29+
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
    For year_counter = 2012 To 2025
40
        For month_counter = 1 To 12
41
            Sheets("subtotals-" + DropDown2.Value + "-" + month_counter).Visible = xlSheetHidden
42
        Next month_counter
43
    Next year_counter
44
45
End Sub