Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default hide , unhide colums

I have a range of columns suppose D-O. Every month one column is
populated with the data. I want to create a Macro which can unhide the
columns with data and hide the empty columns.

thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default hide , unhide colums

Sub HideColumns()
Dim cell as Range, cnt as Long
for each cell in Range("D1:O1")
cnt = Application.CountA(cell.entireColumn)
if cnt < 2 then
cell.EntireColumn.Hidden = True
else
cell.EntireColumn.Hidden = False
end if
next
end Sub

" wrote:

I have a range of columns suppose D-O. Every month one column is
populated with the data. I want to create a Macro which can unhide the
columns with data and hide the empty columns.

thanks


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
Macro to hide rows/colums by value [email protected] Excel Programming 7 September 14th 06 02:45 PM
Macro to Hide Colums keen learner Excel Programming 2 March 8th 06 12:10 PM
What is the quickest way to hide a lot of rows and colums ? Stephen Tyrrell Excel Discussion (Misc queries) 2 August 19th 05 08:20 AM
How can I hide data in colums. Gord Excel Discussion (Misc queries) 4 June 1st 05 08:10 PM
Hide colums based on dropdown list mgronov - ExcelForums.com Excel Programming 4 October 6th 04 05:05 AM


All times are GMT +1. The time now is 10:34 PM.

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

About Us

"It's about Microsoft Excel"