+ Reply to Thread
Results 1 to 6 of 6

Multiple Rules for Worksheet_Change

  1. #1
    Registered User
    Join Date
    03-16-2009
    Location
    Essex, England
    MS-Off Ver
    Excel XP, 2003 & 2010
    Posts
    30

    Multiple Rules for Worksheet_Change

    I want to have a VBA code on a worksheet that monitors multiple cells and executes the appropriate macro is any are changed to "Yes" from the drop-down. The current code:
    Please Login or Register  to view this content.
    Appears to run MIFAC if any of D14, D15, D16 or D17 are changed to "Yes", not just D14.

    I have tried doubling up the whole code, which just results in an ambiguous name error, and have tried to use:
    Please Login or Register  to view this content.
    But this results in both MIFAC and BFGFAC being run if either D14 or D15 are selected as yes.

    What I want is that if D14 is Yes then MIFAC is run, if D15 is Yes then BFGFAC is run and if D16 is Yes then KORFAC is run.

    Do-able?
    I'm not a VB master, in fact I'm pretty much learning as I go.
    Any assistance gladly accepted.
    Last edited by V8Maverick; 07-14-2010 at 02:57 PM. Reason: Problem Solved

  2. #2
    Registered User
    Join Date
    03-16-2009
    Location
    Essex, England
    MS-Off Ver
    Excel XP, 2003 & 2010
    Posts
    30

    Re: Multiple Rules for Worksheet_Change

    Quote Originally Posted by romperstomper View Post
    Hi,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    Please edit it accordingly and then we will respond.

    Thanks.

    As requested. Thanks for guidance

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,282

    Re: Multiple Rules for Worksheet_Change

    Thank you.

    The problem is you are checking the cell value, not its address:
    Please Login or Register  to view this content.
    checks if the target cell value is equal to the value in D14.
    What you want is something like:
    Please Login or Register  to view this content.
    for example.
    Remember what the dormouse said
    Feed your head

  4. #4
    Registered User
    Join Date
    03-16-2009
    Location
    Essex, England
    MS-Off Ver
    Excel XP, 2003 & 2010
    Posts
    30

    Re: Multiple Rules for Worksheet_Change

    A quick and easy reply, thanks. Next problem, I have a user input box which requests a value, but does not accept decimal points - E.g. User Inputs 2.5, it dumps 2.0 into the cell.
    Please Login or Register  to view this content.
    Thanks for the continued assistance.

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,282

    Re: Multiple Rules for Worksheet_Change

    You declared your variable as a Long Integer so it only accepts whole numbers. Declare it as Double instead.

  6. #6
    Registered User
    Join Date
    03-16-2009
    Location
    Essex, England
    MS-Off Ver
    Excel XP, 2003 & 2010
    Posts
    30

    Re: Multiple Rules for Worksheet_Change

    Marvellous, Thankyou!

+ 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