VBA Code and Checkboxes

  • Thread starter Thread starter Gimp
  • Start date Start date
G

Gimp

I have a checkbox on a user form that when checked adds $30.00 to the
value in a textbox. What I want to do is add more code that takes the
$30.00 away or subtracts it. Say for example the user hits the
checkbox and realizes that this was an error, then unchecks the
box....I want that $30.00 that was added when it was first checked to
be removed or subtracted once it's unchecked...here is my code so far:


If CheckBox1.Value = True Then
TextBox32.Value = CDbl(TextBox32.Text) + 30
End If
TextBox32.Text = Format(TextBox32.Text, "currency")


This is in the checkbox sub.

So is there a 'changes to' type function that can be used?
 
I have a checkbox on a user form that when checked adds $30.00 to the
value in a textbox. What I want to do is add more code that takes the
$30.00 away or subtracts it. Say for example the user hits the
checkbox and realizes that this was an error, then unchecks the
box....I want that $30.00 that was added when it was first checked to
be removed or subtracted once it's unchecked...here is my code so far:

If CheckBox1.Value = True Then
TextBox32.Value = CDbl(TextBox32.Text) + 30
End If
TextBox32.Text = Format(TextBox32.Text, "currency")

This is in the checkbox sub.

So is there a 'changes to' type function that can be used?

Wait...I just got this to work...thanks to anyone who was going to
respond....!!!

I just added a 'false' statement after the above code and it behaves
like a toggle switch....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top