Results 1 to 22 of 22

Conditionally Hide Columns

Threaded View

Gos-C Conditionally Hide Columns 03-10-2010, 10:06 AM
Marcol Re: Conditionally Hide Columns 03-10-2010, 10:32 AM
Kafrin Re: Conditionally Hide Columns 03-10-2010, 10:38 AM
Marcol Re: Conditionally Hide Columns 03-10-2010, 10:47 AM
Kafrin Re: Conditionally Hide Columns 03-10-2010, 10:52 AM
Gos-C Re: Conditionally Hide Columns 03-10-2010, 11:55 AM
Gos-C Re: Conditionally Hide Columns 03-23-2010, 01:17 PM
Marcol Re: Conditionally Hide Columns 03-10-2010, 12:33 PM
Gos-C Re: Conditionally Hide Columns 03-10-2010, 12:53 PM
Marcol Re: Conditionally Hide Columns 03-10-2010, 04:04 PM
Gos-C Re: Conditionally Hide Columns 03-11-2010, 09:44 AM
Marcol Re: Conditionally Hide Columns 03-11-2010, 04:27 PM
Gos-C Re: Conditionally Hide Columns 03-11-2010, 04:49 PM
Gos-C Re: Conditionally Hide Columns 03-12-2010, 11:37 AM
Marcol Re: Conditionally Hide Columns 03-12-2010, 12:27 PM
Gos-C Re: Conditionally Hide Columns 03-12-2010, 12:55 PM
Marcol Re: Conditionally Hide Columns 03-14-2010, 12:38 AM
Gos-C Re: Conditionally Hide Columns 03-14-2010, 09:41 AM
Gos-C Re: Conditionally Hide Columns 03-17-2010, 09:37 PM
Marcol Re: Conditionally Hide Columns 03-18-2010, 08:22 AM
Gos-C Re: Conditionally Hide Columns 03-18-2010, 11:59 AM
Marcol Re: Conditionally Hide Columns 03-23-2010, 01:44 PM
  1. #20
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Conditionally Hide Columns

    1/. The Toggle Columns button should hide/unhide column Q together with columns U:CQ.
    Changes
    I have added "Q" to the if statement to define the exact condition to toggle under.
    I have changed the Toggle Button caption to suit.

    2/. For column D, there should be three cases
    Changes
    None - Your code modification is fine.

    3/. Columns S:T should be hidden when CM, LR, MG or NR is selected, and unhidden when any other code is selected.
    Changes
    I have added Columns("S:T").Hidden = False to Case "CR", "GN", "PA", "SC" to fullfill the unhidden condition.

    4/. If the user deletes the contents of a cell in column D, the contents of the cells in columns Q and S:CQ for that row should be deleted, and all columns unhidden.
    Changes
    I have added code to handle this condition. It will require testing to cover possible user situations I am unaware of
    Note the use of Application.EnableEvents = False/True in this additional code.

    5/. Instead of: ‘if delete is used (in column Q) then unhide all columns and exit,.........
    Changes
    I have added code to handle this condition.
    Code in 4/. will override this on occassions , this is unavoidable, but it is probably correct to do so.

    In most of the above, I cannot say for sure that the result is correct, I cannot verify the required conditions, only you can do this.
    The methods used, however, should put you on the right track.

    6/. Also, can you please explain “isect”? It’s the first time I am seeing it in macros.
    This is the variable name Set by the Intersect function.
    In this line
    Set isect = Application.Intersect(Target, Range("D:D,Q:Q"))
    Highlight Intersect press f1 to see an explaination by microsoft

    In my experience Worksheet_Change is seldom used without it.

    Help in Excel VBa is invaluable it contains a mine of information. Use it!!!

    I have attached an amended workbook for your evaluation.

    Please let me know how you get on with it.

    Regards
    Alistair

    If this takes care of your needs, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED. It helps everybody!
    Also
    If you are satisfied by any members response to your problem please consider using the scales icon top right of thier post to show your appreciation.
    Attached Files Attached Files

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