Minx_Minxy
New Member
- Joined
- Jul 13, 2015
- Messages
- 37
- Office Version
- 365
- Platform
- Windows
I have two sheets, "Operation" and "EHSQ", I want to be able to hide and unhide certain columns on these sheets, I am thinking of using a a shape and assign the macro where the user can press, like Q1, Q2, Q3 etc. So the user hits Q1, if the columns are unhidden, then the macro hides it and vice versa.
The columns on each sheets are different:
I need the macro to:
1) make it work to hide and unhide when user hit the shape with the macro assigned
2) make it work not only in the Operations sheet, but for EHSQ as well
This is what I got so far
Code for Operations
This one is for EHSQ:
The columns on each sheets are different:
I need the macro to:
1) make it work to hide and unhide when user hit the shape with the macro assigned
2) make it work not only in the Operations sheet, but for EHSQ as well
This is what I got so far
Code for Operations
VBA Code:
Sub Q1_Hide
Columns("H:J").Select
Selection.EntireColumn.Hidden = True
End Sub
Sub Q2_Hide
Columns("K:M").Select
Selection.EntireColumn.Hidden = True
End Sub
Sub Q3_Hide
Columns("N:P").Select
Selection.EntireColumn.Hidden = True
End Sub
Sub Q4_Hide
Columns("Q:S").Select
Selection.EntireColumn.Hidden = True
End Sub
SubQ1_UnHide
Columns("H:J").Select
Selection.EntireColumn.Hidden = False
End Sub
SubQ2_UnHide
Columns("K:M").Select
Selection.EntireColumn.Hidden = False
End Sub
SubQ3_UnHide
Columns("N:P").Select
Selection.EntireColumn.Hidden = False
End Sub
SubQ4_Unhide
Columns("Q:S").Select
Selection.EntireColumn.Hidden = False
End Sub
This one is for EHSQ:
VBA Code:
SubQ1_Hide
Columns("G:I").Select
Selection.EntireColumn.Hidden = True
End Sub
SubQ2_Hide
Columns("J:L").Select
Selection.EntireColumn.Hidden = True
End Sub
SubQ3_Hide
Columns("M:O").Select
Selection.EntireColumn.Hidden = True
End Sub
SubQ4_Hide
Columns("P:R").Select
Selection.EntireColumn.Hidden = True
End Sub
SubQ1_UnHide
Columns("G:I").Select
Selection.EntireColumn.Hidden = False
End Sub
SubQ2_UnHide
Columns("J:L").Select
Selection.EntireColumn.Hidden = False
End Sub
SubQ3_UnHide
Columns("M:O").Select
Selection.EntireColumn.Hidden = False
End Sub
SubQ4_Unhide
Columns("P:R").Select
Selection.EntireColumn.Hidden = False
End Sub
Last edited by a moderator: