Results 1 to 4 of 4

Hide/Unhide columns based on whether 'x' appears in that column or not

Threaded View

  1. #1
    Registered User
    Join Date
    12-27-2016
    Location
    Ontario, Canada
    MS-Off Ver
    2010
    Posts
    38

    Hide/Unhide columns based on whether 'x' appears in that column or not

    I would like to hide/unhide columns based on whether I put an 'x' in row 1. I presume that I have to determine the last used column and then do a for each along row 1 to evaluate if there is the value 'x' in it. If it does then hide it or unhide it depending on which of the two actions I have chosen. What I need help with is how to reference the column by number so that the for each loop works. With the code below, how can I refer to the "L:L" numerically so that the loop works?
    Or, maybe there is a whole better approach than what I am thinking. In any case, any pointers much appreciated.

        Columns("L:L").Select
        Selection.EntireColumn.Hidden = True
    Last edited by alansidman; 05-08-2018 at 09:15 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hide/unhide 2 columns based on checkbox
    By horsefish01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2015, 03:27 AM
  2. hide and unhide columns based on cell value
    By darijokesar in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-29-2014, 03:51 AM
  3. [SOLVED] Hide/Unhide columns based on the value of the cell help!
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-11-2014, 09:03 PM
  4. Replies: 2
    Last Post: 06-21-2013, 10:04 AM
  5. Hide and unhide columns based on value of 0 or 1 (respectively) in cells G1:LG1
    By cplawren in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-22-2012, 01:58 AM
  6. Hide & Unhide columns based on a cell value
    By DaveNUFC in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-21-2010, 09:40 AM
  7. Hide or Unhide certain columns based on a cell value
    By gonecrazybacksoon@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2006, 01:04 PM

Tags for this Thread

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