+ Reply to Thread
Results 1 to 7 of 7

How to amalgamate multiple worksheet_change events on one sheet. Coding help!!

  1. #1
    Registered User
    Join Date
    10-04-2012
    Location
    Perth, Western Australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    How to amalgamate multiple worksheet_change events on one sheet. Coding help!!

    Hi all!

    Please help!

    I have a page im using for data entry. I have the one data entry form feed into 5 different sections (days) based on what date is input above the form.

    The code i have below clears the form cell range when i change the date, therefore giving me a fresh form for the next day for data entry. I have 17 of these forms going down the page (1 for each category of card) and need these to work as individual forms. (Hope this makes sense)

    It works when i have the one worksheet_change event but that only allows one form to work the way i want. I now need 16 more forms to work like the first one. I am to understand that you cant have multiple worksheet_change events (Like ive done below).

    Is there anyway to amalgamate the below codes into one? Im still new to VBA and have been teaching myself off these forums the best i can.

    Thanks in advance! (My apologies for the long code)

    Please Login or Register  to view this content.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to amalgamate multiple worksheet_change events on one sheet. Coding help!!

    leggy59,

    Welcome to the forum!
    Untested, but this should work:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    10-04-2012
    Location
    Perth, Western Australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How to amalgamate multiple worksheet_change events on one sheet. Coding help!!

    Thanks so much for your reply!

    When i enter the code and try to test the macro it runs the debugger and highlights this line below.

    Please Login or Register  to view this content.
    The macro works in the regard that when i change the date on any of the 17 forms it clears the corresponding form. But now when i go to enter data in the form it shows "Run-time error '91' Object variable or with block variable not set" and then runs the debugger.

    I have no idea what this means, any help is highly appreciated!!

    Thanks

  4. #4
    Registered User
    Join Date
    10-04-2012
    Location
    Perth, Western Australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How to amalgamate multiple worksheet_change events on one sheet. Coding help!!

    To expand on the above. When i enter a number in the form the runtime error appears but if i press "end" i can enter my numbers repeating that process and the forms work as they should. If that error didnt appear after each number i enter it would work perfect

  5. #5
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to amalgamate multiple worksheet_change events on one sheet. Coding help!!

    Updated code:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-04-2012
    Location
    Perth, Western Australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How to amalgamate multiple worksheet_change events on one sheet. Coding help!!

    You're simply amazing!

    Thankyou so much!!

  7. #7
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to amalgamate multiple worksheet_change events on one sheet. Coding help!!

    You're very welcome

+ Reply to Thread

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