+ Reply to Thread
Results 1 to 8 of 8

Change Textbox Value automatically upon data entered

  1. #1
    Registered User
    Join Date
    09-01-2017
    Location
    London
    MS-Off Ver
    2016
    Posts
    28

    Change Textbox Value automatically upon data entered

    Hi all,

    I have the following code that places the values from text boxes in a excel form, but it doesn't automatically change unless I click inside the textbox itself, is there a way for it to automatically change depending on the data entered?

    Please Login or Register  to view this content.
    Thanks in advance.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Change Textbox Value automatically upon data entered

    That is because the change event does not happen unless you enter the FinalDonations text box.
    As you are not entering anything place the statement in either the Donation textbox or TotalTextBox which ever is the last to be updated with data entered.

  3. #3
    Registered User
    Join Date
    09-01-2017
    Location
    London
    MS-Off Ver
    2016
    Posts
    28

    Re: Change Textbox Value automatically upon data entered

    Thanks for your explanation, no matter what I try nothing happens, this is my full code (I've changed some of the text boxes to make it easier for us to understand)..

    Please Login or Register  to view this content.
    MonthsBox displays how many months the person has donated.
    TotalTextBox displays the final calculation amount by how many months, times the donation amount (we have two which I select from a drop down combobox)
    FinalDonation adds the CashDonation amount and the TotalTextBox together to show how much a person has donated to our charity.

    All works, just a pain keep placing a number in the FinalDonations to show the final amount.

    The main places I will edit are the donation amount and the cash. Any help would be grateful.

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Change Textbox Value automatically upon data entered

    far easier to give a concise solution with a copy of the workbook.
    see big yellow banner - how to upload a workbook.
    replace the data with a dozen rows of de-sensitised data - as long as the structure and any formatting/formula are in place.
    torachan.

  5. #5
    Registered User
    Join Date
    09-01-2017
    Location
    London
    MS-Off Ver
    2016
    Posts
    28

    Re: Change Textbox Value automatically upon data entered

    Thank you, I've attached the form (updated the names, I was getting myself confused - which is very easy lol)
    Attached Files Attached Files

  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Change Textbox Value automatically upon data entered

    Sorry, have been busy, however looked through your form, not 100% understanding the period logic.
    My approach is always not to have any formula within the data storage area, it takes too much maintaining and very often causes conflicts, especially if there are masses of calculations every time a value is changed, so I control and restrict everything to code.
    For presentation and structure tables are the best method of data storage, they are virtually self maintaining, you do not have to bother with range sizes and alterations.
    I have used table referencing on the 'cells' on the 'Start' sheet - you will see from these that there is no need to maintain (i.e. no need to expand your range references).
    Also within the code there is no need to constantly 'lookup' data - once the 'user combobox' is loaded with the data array you can refer to it in memory instead of constantly reading the sheet - the larger the app the quicker this method is - similarly if you have all your textboxes set in the order of you data store you can loop through them instead of referencing each individually by name - again the bigger the app the greater the saving on code.
    Any queries post back on this site - I will do my best to explain.
    torachan.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-01-2017
    Location
    London
    MS-Off Ver
    2016
    Posts
    28

    Re: Change Textbox Value automatically upon data entered

    WOW Thank you so much, looks great I'm still learning VBA but this is a next level. Amazing thank you.

  8. #8
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Change Textbox Value automatically upon data entered

    thanks for the feed-back.
    glad to help.
    torachan.

+ 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. [SOLVED] Textbox doesnt automatically regain focus until textbox entered
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-12-2019, 12:35 PM
  2. [SOLVED] Data entered from Userform Textbox shoud be in sheet2 z5
    By Akbarov in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-01-2018, 06:24 AM
  3. [SOLVED] Updating text in shape using data entered in a textbox in userform.
    By Awni in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-23-2016, 06:48 AM
  4. Replies: 6
    Last Post: 04-24-2015, 03:16 AM
  5. Replies: 2
    Last Post: 08-21-2014, 01:27 PM
  6. TextBox Value Change automatically...
    By z-eighty2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2013, 11:01 PM
  7. automatically change the data entered into a cell to a specific format
    By aadifede in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2012, 03:34 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