+ Reply to Thread
Results 1 to 5 of 5

Negetive numbers/Subtracting values in userforms.

  1. #1
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Negetive numbers/Subtracting values in userforms.

    Hi, I have a userform where the user will enter (in textboxes) quantities of products which have been dispatched. At the moment when the userform is submitted it will add the values to its assigned cell in sheet1. What I would like to do is to make the userform subtract the value, or force the numbers entered to become negative, so that they can be reduced from a running balance of product quantities.

    Does anyone have any ideas how I could code the userform to achieve this? Thanks in advance for any help you can offer me.
    Last edited by BPSJACK; 03-13-2012 at 08:50 AM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Negetive numbers/Subtracting values in userforms.

    BPSJACK,

    Here's one way...
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Re: Negetive numbers/Subtracting values in userforms.

    My userform needs to enter the data to the next empty row. When I used the ABS value to subtract it as suggested , I just return a value of zero each time. I tried to amateurly modify it but now get a runtime type mismatch. Can anyone more knowledgeable than me see where I’m going wrong?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Negetive numbers/Subtracting values in userforms.

    BPSJACK,

    Do those textboxes contain numeric data?

  5. #5
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Re: Negetive numbers/Subtracting values in userforms.

    Your question pushed me in the right direction. I noticed that it wouldnt throw up an error when every text box had numeric data entered to it. So I just set it to assign a zero (used code below) to textboxes whenever they are left blank. Seems to have solved the problem.


    Please Login or Register  to view this content.

+ 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