+ Reply to Thread
Results 1 to 5 of 5

Hiding Unecessary Columns

  1. #1
    Registered User
    Join Date
    04-03-2008
    Posts
    7

    Hiding Unecessary Columns

    Hi there,

    I am putting together a spreadsheet which requires empty columns to be hidden. I would normally use data filter with rows, but obviously Exel doen't have an equivalent filter for columns. Can anybody help me with the code for a macro that would work like data filter, but hiding columns not rows? Ideally I would have either a " 1 " at the top of the column if the column is to be displayed and a " 0 " if the column should be hidden - I am guessing some sort of conditional macro would do the job. It could either be automatic, or activated by a run command, whichever.

    Many thanks in advance for any help.

    Cheers,
    John.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why do you require empty columns? It's bad design if you are trying to create a table of data to do this.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    04-03-2008
    Posts
    7
    Hi Roy, thanks for coming back to me. I have a 120 month discounted cashflow worksheet for property development, which may require all 120 months, or just 12 (or 24 or whatever the length of the project). One month represents one column, with the cash flows being presented horizontally. The issue I have is that the "empty" columns do actually contain formulae, but if I am doing a shorter project, I don't want the redundant colums to be visible - its simply a presentation issue. However, I do not want these columns deleted as the model will be re-used for varying project lengths. Therefore, I need these automatically hidden when not required, but visible if required for a longer development project. Does that explain it a little better?

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Place the number of columns required in A1, the code uses sheet1 but you can change this. Then use the workbook_open event to hide unnecessary columns

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-03-2008
    Posts
    7
    Cheers Roy,
    I've just tried that on a blank worksheet and it works well - I think I will be able to use it to solve my problem. Thanks very much again for your time and help - it's great to find people who are so happy to help others in this way.
    John.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1