+ Reply to Thread
Results 1 to 6 of 6

Run macro upon value entered in B1 only if B1 > value in A1?

  1. #1
    Registered User
    Join Date
    09-20-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    16

    Question Run macro upon value entered in B1 only if B1 > value in A1?

    I've been using this Visual Basic code to run a macro when a value is entered into cell B1:

    Please Login or Register  to view this content.

    How would I change it so that the macro only runs when the value in cell B1 is greater than the value cell A1?

    Thank you!
    Last edited by Fotis1991; 10-02-2014 at 06:35 AM. Reason: pls use code tags around your codes

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Run macro upon value entered in B1 only if B1 > value in A1?

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-20-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    16

    Re: Run macro upon value entered in B1 only if B1 > value in A1?

    Works! Thank you

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Run macro upon value entered in B1 only if B1 > value in A1?

    You're welcome. Glad to help out and thanks for the feedback. Please mark your thread as Solved: Either Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes.

  5. #5
    Registered User
    Join Date
    09-20-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    16

    Re: Run macro upon value entered in B1 only if B1 > value in A1?

    Using the code suggested above, it works fine except when I delete the value out of the cell - it throws up the Run-time error '13' Type Mismatch. Do you know why?

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Run macro upon value entered in B1 only if B1 > value in A1?

    Try:

    Please Login or Register  to view this content.
    I think it is reading "" as text.

+ 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. Run a Macro when value is entered in a cell
    By anandvh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2013, 12:20 PM
  2. Macro pops up when certain value is entered
    By sigmund_domingo in forum Excel General
    Replies: 3
    Last Post: 11-25-2010, 11:36 PM
  3. Macro to deduct entered value
    By The Last Day Dawns in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-20-2010, 09:39 AM
  4. Replies: 0
    Last Post: 05-25-2009, 06:58 PM
  5. Replies: 2
    Last Post: 04-25-2009, 04:19 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