Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default hiding columns

So you have a worksheet with categories laid out across the top (say row 1) and
maybe some description in column A?

You could put a couple of buttons from the Forms toolbar on the worksheet that
run macros to hide/show the columns.

I'd resize row 1 and column A to fit both buttons (so that they're always
visible).

Then assign the buttons to one of these macros:

Option Explicit
Sub HideCols()

Dim iCol As Long
Dim LastCol As Long

Application.ScreenUpdating = False
With ActiveSheet
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
For iCol = 2 To LastCol
If Application.Sum(.Columns(iCol)) = 0 Then
'hide the column
.Columns(iCol).Hidden = True
Else
.Columns(iCol).Hidden = False
End If
Next iCol
End With
Application.ScreenUpdating = True

End Sub
Sub ShowCols()
With ActiveSheet
.Columns.Hidden = False
End With
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm



wrote:

I am hoping someone can help me out with this. I have set up a
spreadsheet to help manage projects around the company. There is an
input worksheet and I would like to hide columns that will not be used
in the project. For example, if the category A01 will not have any
funds applied to it, I would like to hide that column. Is there any
way to do this without having to do it manually?

If you need more information let me know and I can try to explain it
better.


--

Dave Peterson
 
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
2 questions one on list/combo boxes and the other on "atomically" hiding columns or rows. Marc New Users to Excel 1 March 4th 06 05:13 AM
EXCEL should let me establish unlimited numbers of columns. DAISY Excel Discussion (Misc queries) 8 February 15th 06 04:35 PM
Hiding multiple columns MDavis Excel Discussion (Misc queries) 1 July 25th 05 08:46 PM
Removing Near-Duplicate Rows, Leaving Those w/Most Data in Specific Columns foofoo Excel Discussion (Misc queries) 1 April 2nd 05 12:02 AM
Hiding columns Adam Excel Discussion (Misc queries) 2 March 31st 05 05:07 PM


All times are GMT +1. The time now is 10:58 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"