+ Reply to Thread
Results 1 to 6 of 6

Multiply one textbox by different textboxes based on conditions

  1. #1
    Registered User
    Join Date
    10-23-2021
    Location
    South Africa
    MS-Off Ver
    365
    Posts
    3

    Unhappy Multiply one textbox by different textboxes based on conditions

    Good afternoon

    Im Lee, and im fairly new to vba so im hoping for some help to the below that i just cannot seem to solve

    so i have a userform project that captures tenant data. everything is working very well so far except for the below issue i have now encountered:

    i have two textboxes (textbox18 ""current water reading"") and (textbox11 ""previous water reading"").

    i have textbox64 that automatically updates when input numbers in textbox18 and textbox11

    textbox64=(textbox18-textbox11)

    the difference in textbox64 must then multiplied by one of 5 different textboxes that hold specific data

    so if textbox64=5 then it is multiplied by the data in textbox70 and so on

    the criteria i have been given is as follows:
    if textbox64 is between 0-6 then multiply by textbox70 (6.82)
    if textbox64 is between 6.1-25 then multiply by textbox71 (45.43)
    if textbox64 is between 25.1-30 then multiply by textbox72 (60.34)
    if textbox64 is between 30.1-45 then multiply by textbox73 (82.82)
    if textbox64 is greater than 45 then multiply by textbox74 (123.02)

    ***the figures in textboxes70-74 will be updated yearly by a different userform***

    my problem is that i cannot seem to find a way to multiply by the correct textbox only when textbox64 is calculated.

    and on top of that, the correct calculation from one of those (textbox64*textbox70 to 74) must then update in real time to textbox21

    ***textbox64, textbox70-74 will all be invisible on the userform***

    am i reaching for something impossible?

    i have spent many hours reading through these posts and im hoping a genius would be able to offer a solution for me.

    please help!

    ps: i hope i have followed the forum rules with this post and if not, i do sincerely apologise.

  2. #2
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Re: Multiply one textbox by different textboxes based on conditions

    Set it up as a case -
    Please Login or Register  to view this content.
    On Update event
    Last edited by alansidman; 11-04-2021 at 06:57 AM.
    If this solves your issue, Mark thread as Solved & Add Reputation.

    Thanks!

  3. #3
    Registered User
    Join Date
    10-23-2021
    Location
    South Africa
    MS-Off Ver
    365
    Posts
    3

    Re: Multiply one textbox by different textboxes based on conditions

    Good Morning Crimedog

    Thank you so much!

    it works perfectly.

    it has updated the spreadsheet with the correct calculation.

    But is there a way that i can have that figure update in textbox21 automatically? in real time as the customer is inputing those current and previous water readings in textbox18 and textbox11?

  4. #4
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Re: Multiply one textbox by different textboxes based on conditions

    Trigger it as an after update on TextBox18 (or whichever the user would update last)

  5. #5
    Registered User
    Join Date
    10-23-2021
    Location
    South Africa
    MS-Off Ver
    365
    Posts
    3

    Re: Multiply one textbox by different textboxes based on conditions

    this worked! thank you so much!

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Multiply one textbox by different textboxes based on conditions

    As you are new, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. Return value from sheet to textboxes based on value on another textbox
    By impresxy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-04-2017, 08:55 AM
  2. [SOLVED] enable number of textboxes based on input in another textbox
    By bqheng in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-25-2017, 08:01 PM
  3. [SOLVED] Sum three textboxes %age in one textbox on userform
    By xlhelp7 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-20-2016, 02:44 AM
  4. How to concatenate two or more textboxes in one textbox
    By beto77 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-03-2016, 05:17 PM
  5. [SOLVED] Several Textboxes values into one textbox
    By sagar007 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-17-2012, 08:11 AM
  6. Replies: 1
    Last Post: 07-06-2011, 10:53 AM
  7. How to update textbox from other textboxes
    By chris0374 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-12-2010, 04:20 PM

Tags for this Thread

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