+ Reply to Thread
Results 1 to 1 of 1

Hide/unhide columns that contain a certain value

  1. #1
    Registered User
    Join Date
    03-13-2015
    Location
    sweden
    MS-Off Ver
    2010
    Posts
    1

    Hide/unhide columns that contain a certain value

    Hi everyone,

    First off, i want you to know that im very new to VBA. I can manage to copy and paste certain data and adapt ranges according to my needs but that is all. Now to my problem:

    I have a row consisting of 31 columns (E27:AI27). All the cells within this range get their input (a number from 1-31) from other cells outside of this range, Let's say from a couple of drop down lists. Depending on how I twerk these drop-down lists the sequence of the numbers in that specific range (E27:AI27) can look like the following alternatives:

    Alt. 01: 1 2 3 4 5................................29 30 31 (31 cells total)

    Alt. 02: 2 3 4 5 6...........................29 30 31 na (31 cells total)

    Alt. 03: 3 4 5 6 7...........................30 31 na na (31 cells total)

    Alt. 04: 4 5 6 7 8......................30 31 na na na (31 cells total)

    etc etc etc.

    Alt. 30: 30 31 na......................na na na na na (31 cells in total)

    Alt. 31: 31 na na..................... na na na na na (31 cells in total)


    Now what I want to do is to automatically, temporarily, hide those columns that contain string "na" within them. When I then re-twerk my drop down lists again, i want to be able to unhide those columns that change back from "na" to a number. For example, i want to be able to shift between alternative 1 and alternative 2 (see above), depeding on how i twerk my drop down lists. Shifting between these two alternatives would mean that AI27 would go from showing, to hiding, to showing, to hiding and so on (while E27AH27 would all be showing since they would all have numbers inside then, 1-30.


    Last but not least, there are two drop down lists that control the values of the cells E27:AI27. Drop down list called month (C18) and drop down list called day (D18). The former (C18) sets the days for a month. If C18=February then there will be 28 days and the last two columns (AH:AI) would be "na". In addition to that the latter drop down list (D18) sets the start day, namly the first number (in cell E27) in the sequence. If D18=21, then the alternative for february month would be:

    21 22 23 24 25 26 27 28 na na na na na na na na na na na na.... (containing 23 na)

    Can anyone please help me set up an easy and short VBA code for this, if possble? Highly appreciated
    Attached Images Attached Images
    Last edited by noob85; 03-14-2015 at 05:13 AM.

+ 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. 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
  2. Hide/Unhide columns
    By N164PJ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2008, 02:30 AM
  3. [SOLVED] Hide and unhide columns
    By Frederic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2005, 05:05 PM
  4. Hide/Unhide Columns
    By Jonsson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2005, 06:24 AM
  5. hide / unhide columns
    By appeng in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2005, 07:06 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