+ Reply to Thread
Results 1 to 6 of 6

Hiding columns with a macro

  1. #1
    Registered User
    Join Date
    05-13-2009
    Location
    london, england
    MS-Off Ver
    Excel 2007
    Posts
    2

    Hiding columns with a macro

    Hi guys, I am a real excel amateur - how do I go about creating a macro which I can click to hide a certain set of columns in a spreadsheet?

    Any help greatly appreciated.

    Regards,

    Rohan

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Hiding columns with a macro

    easiest way is to record one. start the macro recorder then do your hide columns
    stop recording
    then start recording again and do another one to unhide.
    now if you look in the macros you will see 2 macros macro1 and macro2 run either of these to do the job
    i'm not sure wher the menu is in 2007 tho'
    http://excel2007tips.blogspot.com/20...xcel-2007.html
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Hiding columns with a macro

    If you simply want to hide the columns you have selected then use the code below, however it can be easily adapted to hide a range of columns. Assign each of the macro's to a button so you can hide/unhide the columns.
    Please Login or Register  to view this content.
    Not all forums are the same - seek and you shall find

  4. #4
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Hiding columns with a macro

    Quote Originally Posted by martindwilson View Post
    i'm not sure wher the menu is in 2007 tho'
    http://excel2007tips.blogspot.com/20...xcel-2007.html
    It's on the developer tab!

  5. #5
    Registered User
    Join Date
    05-13-2009
    Location
    london, england
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Hiding columns with a macro

    Thats a great help lads - thanks

  6. #6
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Hiding columns with a macro

    If we have solved your original query please mark your thread solved by going to your first post in this thread>Edit>Go Advanced then at the top near the title you will see a prefix dropdown change this to solved and click save!

+ 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