+ Reply to Thread
Results 1 to 2 of 2

Macro to hide columns based on cell values in the column to be hidden

  1. #1
    Registered User
    Join Date
    02-15-2012
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    9

    Macro to hide columns based on cell values in the column to be hidden

    Hi. I have a worksheet that I want to hide columns based upon the value of a cell in the column to be hidden.
    i.e. if the value of the cells in range G5:DO5 is = "optl" then hide the column of that cell. Otherwise that column is to be visible.

    Thank you!

  2. #2
    Valued Forum Contributor
    Join Date
    12-05-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010 & 2013
    Posts
    308

    Re: Macro to hide columns based on cell values in the column to be hidden

    Hi JCMus

    Here is some simple code. It assumes the test value is stored in cell A1:
    Please Login or Register  to view this content.
    You could use this in a Worksheet_Change macro and activate it every time cell A1 changes. If you wanted to do this, copy the following in the the Worksheet's macros (i.e. in the sheet itself in the VBA Editor):
    Please Login or Register  to view this content.
    Regards, Rob.

+ 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