+ Reply to Thread
Results 1 to 8 of 8

Marco to hide and unhide columns

  1. #1
    Forum Contributor
    Join Date
    11-13-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    279

    Marco to hide and unhide columns

    Hi folks,

    Please can you help with a macro. I need it to hide all unhidden columns between B and G when I press it once, (whilst leaving all hidden columns hidden). Therefore after pressing the macro once, all columns between B and G will be hidden.

    The tricky part:

    When I then hit the button again, I want it to be clever enough to only unhide the columns that were not already hidden. So the macro needs to somehow remember which columns were not unhidden before.

    As an example:

    Start phase:

    B:G all open apart from C and D.

    Press macro.

    Phase 1:

    All B:G columns hidden

    Press macro again

    Phase 2:

    All columns become unhidden, apart from C and D. Thus reverting to the start phase.

    Not sure if this is possible, would appreciate any efforts, successful or otherwise.

    Thank you very much

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Marco to hide and unhide columns

    Does this help?

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-13-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    279

    Re: Marco to hide and unhide columns

    Hi John,

    I think you are on to something.

    Is there any chance you could provide some instructions for how I can modify the formula so it applies for columns B to T instead?

    Thanks very much indeed

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Marco to hide and unhide columns

    You're welcome. Glad to help out.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-13-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    279

    Re: Marco to hide and unhide columns

    Hi John. Thank you for that. Is there any chance you could do a simpler one, which simpler hides all the columns b:g when hit once. And then unhides them all when you hit it again? thanks very much

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Marco to hide and unhide columns

    Perhaps:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    11-13-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    279

    Re: Marco to hide and unhide columns

    Hi John,

    You know what I have realised I should just use the group columns function in Excel instead. Thanks very much for your help all the same. Apols for wasting your time a bit!

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Marco to hide and unhide columns

    Not a problem. Glad you found a solution and thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hide/Unhide Columns
    By dami123 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-08-2015, 12:28 PM
  2. Hide and Unhide Columns
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-21-2015, 09:22 AM
  3. Hide/unhide columns that contain a certain value
    By noob85 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2015, 06:22 PM
  4. VBA will hide columns, but not unhide them
    By JontyRhodes in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-16-2015, 12:54 PM
  5. Hide/Unhide columns
    By N164PJ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2008, 02:30 AM
  6. [SOLVED] Hide and unhide columns
    By Frederic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2005, 05:05 PM
  7. hide / unhide columns
    By appeng in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2005, 07:06 PM

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