Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50165

Hide columns basic on user selection a week

$
0
0
I need a way in a user form for the end user to select a 1 week time span. The one week time span to be able to start on either Sunday or Wednesday (depending on user form). I do currently have a working copy on the workbook that for each of the buttons it is code to hide everything but the week selected and every year I have to go and change the macros to show the proper information, but I know there has to be a better way of doing this. I have attached a sample sheet.

sample3.zip

The User Forms are
Pick_Week_D
Pick_Week_M

Any Help you can provide would be much appreciated.

Thank You

Current Code
Code:

' This Overtime Sheet is brought to you by Bramz
' Each button On this User Form Will hide the dates that are not
' associate with the week selected for day shift OT
' Then loads the Typ_OT User Form
Private Sub btn_w_1_Click()
    Range("J:NG").EntireColumn.Hidden = True
    Unload Pick_Week_D
    Typ_OT.Show
End Sub
Private Sub btn_w_2_Click()
    Range("G:I,Q:NG").EntireColumn.Hidden = True
    Unload Pick_Week_D
    Typ_OT.Show
End Sub
Private Sub btn_w_3_Click()
    Range("G:P,X:NG").EntireColumn.Hidden = True
    Unload Pick_Week_D
    Typ_OT.Show
End Sub


Viewing all articles
Browse latest Browse all 50165

Trending Articles