+ Reply to Thread
Results 1 to 8 of 8

macro hide unhide upon open based on cell value

  1. #1
    Registered User
    Join Date
    05-12-2010
    Location
    Adrian, MI
    MS-Off Ver
    Excel 2010
    Posts
    76

    macro hide unhide upon open based on cell value

    I posted before and no one got back with me...so i created a test workbook. In the workbook you can see that in row 6 there are numbers. If the number is less than 0 i want the macro to automatically unhide the columns, if the number is higher than 0 i want it to keep hidden or hide the column. The number is calculated on the "Now" function and the date i have in row 7. Please help. I would like the macro to run upon opening the workbook.
    Attached Files Attached Files
    Last edited by aehartle; 12-28-2010 at 03:26 PM.

  2. #2
    Forum Contributor
    Join Date
    01-13-2006
    Location
    Texas
    Posts
    161

    Re: macro hide unhide upon open based on cell value

    this is probably not terribly difficult, but you'll get a much faster response if you post in the programming forum, not general.

  3. #3
    Registered User
    Join Date
    05-12-2010
    Location
    Adrian, MI
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: macro hide unhide upon open based on cell value

    is ther a way to just transfer it over there or will i have to repost?

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: macro hide unhide upon open based on cell value

    Perhaps something like this?

    There is also i macro called "Unhide_Columns" in the workbook. Run this to unhide.

    HTH

    Alf
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-12-2010
    Location
    Adrian, MI
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: macro hide unhide upon open based on cell value

    Ya this will work....Thanks!!1

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: macro hide unhide upon open based on cell value

    Glad to be of help and if this solves your problem could you please mark your thread "Solved" and if you like to give me a pat on the back click on my scale icon and give my answer a rating.

    Alf

  7. #7
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: macro hide unhide upon open based on cell value

    Hi again

    Could you please change the macro

    Please Login or Register  to view this content.
    to this

    Please Login or Register  to view this content.
    as the last code is taking in account the columns that are actually used in the worksheet.

    Alf

  8. #8
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: macro hide unhide upon open based on cell value

    It seems like a "never ending story" but I found a fault of the logic in the Auto_Open macro.

    Colums that were hidden will not be unhidden as time passes. So I've changed the macro to this:

    Please Login or Register  to view this content.
    and that should fix the problem.

    So cell values greater than 0 or less than 0 is taken care of. What about cell values equal 0? Will that ever happend and if so what action should be take?

    Alf

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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