+ Reply to Thread
Results 1 to 3 of 3

Adjust Value automatically when entering new value

  1. #1
    Forum Contributor
    Join Date
    11-01-2013
    Location
    Atlanta, GA USA
    MS-Off Ver
    Excel 2010
    Posts
    115

    Adjust Value automatically when entering new value

    This seems like it should be easy, but we're stumped! Help please!!


    In simplicity: We want to be able to enter a value in cell A1 (and hit enter), but we want the value in A1 to be increased by the value saved in H1.

    So: if H1 had 250 saved in it, if we enter 150 in A1 (and hit enter), we want the value in A1 to become 400.



    Any help would be greatly appreciated! Thanks

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Adjust Value automatically when entering new value

    Hi IR,

    You can use the Worksheet_Change event in VBA to accomplish this task. Right-click the worksheet tab for which you want this code to run, then choose View Code.

    In the VBA editor window, paste the following code then close the editor window:
    Please Login or Register  to view this content.
    Try it out!

    Note: The EnableEvents lines prevent an infinite loop since changing the value of the target cell would continuously call the change event. The error handling was added so that if you have a non-numeric value in H1 it won't crash the macro and leave events disabled - which would stop all future macros from running until you re-enabled them.

  3. #3
    Forum Contributor
    Join Date
    11-01-2013
    Location
    Atlanta, GA USA
    MS-Off Ver
    Excel 2010
    Posts
    115

    Re: Adjust Value automatically when entering new value

    Paul, thank you so much for your solution to our problem. We'll see if we can make it work! We really appreciate your help!!

+ 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. Automatically adjust rowheight?
    By h0ps in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2012, 11:51 AM
  2. How to automatically adjust a field
    By Munky in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-22-2008, 09:01 PM
  3. [SOLVED] adjust automatically size margins
    By bebert in forum Excel General
    Replies: 0
    Last Post: 02-26-2006, 07:15 PM
  4. [SOLVED] Adjust the size of cells automatically
    By Dajana in forum Excel General
    Replies: 1
    Last Post: 09-06-2005, 10:05 AM
  5. Column widths to adjust automatically?
    By lambola in forum Excel General
    Replies: 1
    Last Post: 01-20-2005, 09:06 PM

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