+ Reply to Thread
Results 1 to 4 of 4

Simple Math Addition

  1. #1
    Registered User
    Join Date
    04-12-2006
    Posts
    39

    Simple Math Addition

    Don't Laugh. I just need to know how to force a value in a textbox to increase by a set amount when I click on a button. I know this code is not right but it will give you the idea of what I want to do.

    Private Sub CommandButton10K_Click()
    Me.TextBoxMileageValue.Value Plus 10000
    End Sub

    When I click the CommandButton10K I just want the value in the TextBoxMileageValue to increase by 10,000

    How do I do that?

    Thanks Jody

  2. #2
    NickHK
    Guest

    Re: Simple Math Addition

    Private Sub CommandButton10K_Click()
    With Me.TextBoxMileageValue
    .Value =CLng(.Value) + 10000
    End With
    End Sub

    NickHK

    "ssjody" <ssjody.2badrq_1153470313.3581@excelforum-nospam.com> wrote in
    message news:ssjody.2badrq_1153470313.3581@excelforum-nospam.com...
    >
    > Don't Laugh. I just need to know how to force a value in a textbox to
    > increase by a set amount when I click on a button. I know this code is
    > not right but it will give you the idea of what I want to do.
    >
    > Private Sub CommandButton10K_Click()
    > Me.TextBoxMileageValue.Value Plus 10000
    > End Sub
    >
    > When I click the CommandButton10K I just want the value in the
    > TextBoxMileageValue to increase by 10,000
    >
    > How do I do that?
    >
    > Thanks Jody
    >
    >
    > --
    > ssjody
    > ------------------------------------------------------------------------
    > ssjody's Profile:

    http://www.excelforum.com/member.php...o&userid=33398
    > View this thread: http://www.excelforum.com/showthread...hreadid=563595
    >




  3. #3
    Greg Wilson
    Guest

    RE: Simple Math Addition

    Further to Nick's reply, you'll need to have a numeric start value
    (presumably zero) or it will raise an error. Right click the text box and
    select Properties. Then enter zero (0) in the Value field. If you for some
    reason prefer it to be blank on open then perhaps this:

    Private Sub CommandButton10K_Click()
    With Me.TextBoxMileageValue
    If .Value = "" Then .Value = 10000 _
    Else .Value = .Value + 10000
    End With
    End Sub

    Regards,
    Greg


    "ssjody" wrote:

    >
    > Don't Laugh. I just need to know how to force a value in a textbox to
    > increase by a set amount when I click on a button. I know this code is
    > not right but it will give you the idea of what I want to do.
    >
    > Private Sub CommandButton10K_Click()
    > Me.TextBoxMileageValue.Value Plus 10000
    > End Sub
    >
    > When I click the CommandButton10K I just want the value in the
    > TextBoxMileageValue to increase by 10,000
    >
    > How do I do that?
    >
    > Thanks Jody
    >
    >
    > --
    > ssjody
    > ------------------------------------------------------------------------
    > ssjody's Profile: http://www.excelforum.com/member.php...o&userid=33398
    > View this thread: http://www.excelforum.com/showthread...hreadid=563595
    >
    >


  4. #4
    Registered User
    Join Date
    04-12-2006
    Posts
    39
    Perfect! Thanks Guys

+ 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