Mar 28 2022 01:22 AM
I am considering of viewing the Q1 (Jan to Mar), Q2 (Jan to June), Q3 (Jan to Sep) and Q4 (Jan tro Dec) ufor Target and Actual months using VBA. The below does not work. Please advise
Cells.Select
Selection.EntireColumn.Hidden = False
Selection.EntireColumn.Hidden = False
Columns("I:Q").Select
Selection.EntireColumn.Hidden = True
Columns("V:AD").Select
Selection.EntireColumn.Hidden = True
End Sub
Sub view2()
'
' view2 Macro
'
'
Cells.Select
Selection.EntireColumn.Hidden = False
Columns("L:Q").Select
Selection.EntireColumn.Hidden = True
Columns("Y:AD").Select
Selection.EntireColumn.Hidden = True
End Sub
Mar 28 2022 03:05 AM
Here is a small example with the month of January, you could extend this to the other months and develop it further.
Hope to have helped you with this.
I know I don't know anything (Socrates)
Mar 28 2022 09:39 PM
Mar 29 2022 04:04 AM
Here is the VBA code, you just have to create a new button for each month and show/hide the columns accordingly.
Option Explicit
Private Sub CommandButton1_Click() ' To Show ONLY your Janaury Columns
'Me.Unprotect ("yourpass")
Application.ScreenUpdating = False
With ActiveSheet
.Range("E:AS").EntireColumn.Hidden = True ' Displays the month of January ONLY
.Range("F:F, S:S").EntireColumn.Hidden = False 'Always Unhides All your Columns from your previous action
End With
Application.ScreenUpdating = True
'Me.Protect ("yourpass")
End Sub
Hope I was able to help you with this information.
I know I don't know anything (Socrates)