Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A formula or macro that will place the date in an adjacent column Bany time something is typed in column A Mike C[_5_] Excel Programming 4 February 27th 08 02:57 AM
Unhide 1 column at a time from named range blonde1030 Excel Programming 9 June 16th 07 01:09 AM
Hiding Column Also hiding text Cindy Excel Programming 0 April 6th 06 07:18 PM
Hiding Rows in a Range based on column A value tig Excel Programming 9 February 9th 06 06:03 PM
EXCEL Sum column based on time range in different column? RD975 Excel Worksheet Functions 2 October 13th 05 05:19 PM


All times are GMT +1. The time now is 11:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"