Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Columns
Hi all
The setup is I have weekdays listed starting with June 1st in C6 goin horizontal across the whole sheet to IV6. I wanted to do workbook_open event where it takes whatever today's date is and hide the columns From C6 through yesterday. Essentially so today's colum will be right next to the B column. So if today's date is in H6, C6-G would become hidden when one were to open the workbook. Thanks so much for the insight. B -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Columns
Range("C6:IV6").EntireColumn.Hidden = False
res = application.Match(clng(Date-1),Range("C6:IV6"),0) if not res is nothing then Range("C6",Range("C6:IV6")(res)).EntireColumn.Hidd en = True End if -- Regards, Tom Ogilvy "rickey24 " wrote in message ... Hi all The setup is I have weekdays listed starting with June 1st in C6 going horizontal across the whole sheet to IV6. I wanted to do a workbook_open event where it takes whatever today's date is and hides the columns From C6 through yesterday. Essentially so today's column will be right next to the B column. So if today's date is in H6, C6-G6 would become hidden when one were to open the workbook. Thanks so much for the insight. Bo --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Columns
Tom
Thanks for the help, but I am getting a 424 error and it i highlighting the line: if not res is nothing then Do you know what this could be? Thanks -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Columns
my bad
should be if not iserror(res) then -- Regards, Tom Ogilvy "rickey24 " wrote in message ... Tom Thanks for the help, but I am getting a 424 error and it is highlighting the line: if not res is nothing then Do you know what this could be? Thanks. --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Columns
Tom
Thanks again for the help, works now. Although I have one las question. Since I only have weekday dates listed in Row C, If today i Monday then the formula doesn't work. Is there a way, to say if Date Monday then ...(Clng(Date - 3) else ...(Clng(Date -1). I am not to worried about opening it up over the weekend. Thanks again B -- Message posted from http://www.ExcelForum.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Columns
Dim idex as Long, res as Variant
Range("C6:IV6").EntireColumn.Hidden = False idex = choose(Weekday(Date,vbSunday),2,3,1,1,1,1,1) res = application.Match(clng(Date-idex),Range("C6:IV6"),0) if not res is nothing then Range("C6",Range("C6:IV6")(res)).EntireColumn.Hidd en = True End if -- Regards, Tom Ogilv -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Want to Hide columns in spreadsheet but NOT hide data in chart. | Charts and Charting in Excel | |||
Hide Columns If... | Excel Discussion (Misc queries) | |||
Hide/Unhide columns using button on top over relevant columns | Excel Discussion (Misc queries) | |||
Hide some columns? | New Users to Excel | |||
Hide columns | Excel Discussion (Misc queries) |