Macro for Hiding one column at a time in a range
I am looking for a macro code that I could attach to command buttons on a
worksheet. I have a table beginning on Column L and goes out to Column BJ which consists of data for Work Week End Dates (1/9 to 12/25). I would like to have one button hide the first column in the data table (Column L). When clicked again, it would hide Column M, clicked again it would hide Column N, etc. The second button when clicked I would like to unhide all of the columns in the range (Columns L to BJ). I am still a novice at macros and VB so any help would be appreciated. |
Macro for Hiding one column at a time in a range
GoBucks,
I have assumed that you did not want to unhide L when you hide M.... Sub HideColumns() Range("L:BJ").SpecialCells(xlCellTypeVisible).Cell s(1).EntireColumn.Hidden = True End Sub Sub UnhideAllColumns() Range("L:BJ").EntireColumn.Hidden = False End Sub HTH, Bernie MS Excel MVP "GoBucks" wrote in message ... I am looking for a macro code that I could attach to command buttons on a worksheet. I have a table beginning on Column L and goes out to Column BJ which consists of data for Work Week End Dates (1/9 to 12/25). I would like to have one button hide the first column in the data table (Column L). When clicked again, it would hide Column M, clicked again it would hide Column N, etc. The second button when clicked I would like to unhide all of the columns in the range (Columns L to BJ). I am still a novice at macros and VB so any help would be appreciated. |
Macro for Hiding one column at a time in a range
Bernie, Thank You!!! Worked Great!
"Bernie Deitrick" wrote: GoBucks, I have assumed that you did not want to unhide L when you hide M.... Sub HideColumns() Range("L:BJ").SpecialCells(xlCellTypeVisible).Cell s(1).EntireColumn.Hidden = True End Sub Sub UnhideAllColumns() Range("L:BJ").EntireColumn.Hidden = False End Sub HTH, Bernie MS Excel MVP "GoBucks" wrote in message ... I am looking for a macro code that I could attach to command buttons on a worksheet. I have a table beginning on Column L and goes out to Column BJ which consists of data for Work Week End Dates (1/9 to 12/25). I would like to have one button hide the first column in the data table (Column L). When clicked again, it would hide Column M, clicked again it would hide Column N, etc. The second button when clicked I would like to unhide all of the columns in the range (Columns L to BJ). I am still a novice at macros and VB so any help would be appreciated. |
All times are GMT +1. The time now is 05:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com