+ Reply to Thread
Results 1 to 6 of 6

Merging multiple Worksheet Change events into one Worksheet_Change, Hide Cols via Yes/No

  1. #1
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Merging multiple Worksheet Change events into one Worksheet_Change, Hide Cols via Yes/No

    I'm having trouble merging these various worksheet change events into one Worksheet_Change. It's very basic. It's supposed to hide a group of columns if a cell has a yes or no in it. It's not working for me tho. Anybody know what I'm doing wrong here?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,868

    Re: Merging multiple Worksheet Change events into one Worksheet_Change, Hide Cols via Yes/

    I'd expect such code would do what you want (do not unhide unnecesserily too many columns):
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Merging multiple Worksheet Change events into one Worksheet_Change, Hide Cols via Yes/

    Quote Originally Posted by Kaper View Post
    I'd expect such code would do what you want (do not unhide unnecesserily too many columns):
    Please Login or Register  to view this content.
    That did it! This is the first time I've tried to combine this many change events into one. I didn't think of adding the sub If statements within each event.

    Thank you so much Kaper! Another lesson learned on this never ending journey of Excel knowledge. The older I get, the more I fall in love with this program.

    May your life be filled with a million good karma's!

    Take Care!
    Mike from California

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Merging multiple Worksheet Change events into one Worksheet_Change, Hide Cols via Yes/

    FWIW,

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  5. #5
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Merging multiple Worksheet Change events into one Worksheet_Change, Hide Cols via Yes/

    Quote Originally Posted by Arkadi View Post
    FWIW,

    Please Login or Register  to view this content.
    Thank you for your reply Arkadi. Your method seems much easier for me to recreate in the future. It's amazing to me how there are basically 99 different ways to approach every problem in excel with VBA.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Merging multiple Worksheet Change events into one Worksheet_Change, Hide Cols via Yes/

    Indeed.... truth is there is no need for the Select Case version over another approach, it just seemed cleaner and I was redoing most of it anyway. The real point of my post was the removal of selecting ranges/columns and then hiding the selection. Unless you truly need the range selected (which is not usually the case), it is much more efficient just to address the range directly. All the selects would only slow down the code (Which is not an issue here in a short macro, but larger tasks make it really noticeable).

    Happy coding

    p.s. Thanks for the rep!

+ 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. [SOLVED] VBA help - multiple worksheet change events
    By tbear1997 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-08-2016, 03:51 PM
  2. [SOLVED] Multiple Worksheet Change events??? "macro" needed to hide/unhide rows multiple instances
    By dgibney in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-02-2014, 03:40 PM
  3. VBA Multiple Worksheet Change Events
    By Zimbo in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-24-2013, 10:58 AM
  4. [SOLVED] Merging Two Worksheet_Change Events
    By swordswinger710 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-04-2012, 04:18 PM
  5. Multiple Worksheet Change Events
    By justinharris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2011, 06:11 PM
  6. Multiple Worksheet Change Events
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 12-13-2010, 06:14 PM
  7. Multiple Worksheet Change Events???
    By Potoroo in forum Excel General
    Replies: 3
    Last Post: 11-28-2006, 12:59 AM

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