+ Reply to Thread
Results 1 to 9 of 9

VBA Multiple Worksheet Change Events

  1. #1
    Forum Contributor
    Join Date
    02-01-2008
    Location
    Perth, Australia
    MS-Off Ver
    Excel 365
    Posts
    135

    Red face VBA Multiple Worksheet Change Events

    Hi All,

    Is anyone able to help me rework the below code so I can run these two macros (or More) within the same sheet. They are coflicting and a message saying an ambiguous name is detected appears.

    Please Login or Register  to view this content.
    Any help is appreciated.

    Cheers

    Adam

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    You can only have 1 Worksheet_Change macro per worksheet

    You need to combinr them into 1 macro

    Also when testing the same condition for mutiple results using Select Case is usually more efficient than using if & ElseIf statements

    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Contributor
    Join Date
    02-01-2008
    Location
    Perth, Australia
    MS-Off Ver
    Excel 365
    Posts
    135

    How to combine

    Hi Mudraker,

    I am not very good with VBA! How would I combine such code to run off different cell changes?

    Cheers

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    zimbo

    I think mudraker has given you an idea on how to comnbine the code.

    I think what you need to do is actually give us an idea, in words, what the code is actually meant to do.

  5. #5
    Forum Contributor
    Join Date
    02-01-2008
    Location
    Perth, Australia
    MS-Off Ver
    Excel 365
    Posts
    135

    Explanation

    Hi Norie,

    In the example shown the first half of the code is for an in cell drop down which when selected will run one of three macros(only one shown). The second part of the code copies the formula's from the previous row in the sheet to the new line being entered (the excel auto formula copy isn't working even though it is selected - note my previous thread).

    I also have another sheet in the same workbook with two cells needing to run seperate macro's on change.

    Cheers

    Adam

  6. #6
    Forum Contributor
    Join Date
    02-01-2008
    Location
    Perth, Australia
    MS-Off Ver
    Excel 365
    Posts
    135
    Hi Norie,

    Is there any way a Worksheet change event can be written so that I can for example have cell A1 run Macro 1, cell A2 run Macro 2, range A3:B10 run macro 3, etc when each are altered?

    Cheers

    Adam

  7. #7
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    02-01-2008
    Location
    Perth, Australia
    MS-Off Ver
    Excel 365
    Posts
    135

    Thumbs up Works a Treat

    Thanks Mudraker,

    That works perfectly.

    Cheers

    Adam

  9. #9
    Registered User
    Join Date
    07-11-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: VBA Multiple Worksheet Change Events

    Quote Originally Posted by mudraker View Post
    Please Login or Register  to view this content.
    ^ This really helped me out too, Mudraker. Thanks!

+ 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. Replies: 0
    Last Post: 08-16-2007, 05:51 AM
  2. Replies: 0
    Last Post: 05-27-2007, 10:22 PM
  3. Populating a worksheet from multiple IF statements
    By kaitewright in forum Excel General
    Replies: 1
    Last Post: 03-02-2007, 08:58 AM
  4. multiple worksheets into one worksheet
    By drocket in forum Excel General
    Replies: 3
    Last Post: 01-10-2007, 05:29 PM
  5. Help! Vba Copy Cell To Different Worksheet.
    By Dabooj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-03-2006, 05:53 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