Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code and Checkboxes
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code and Checkboxes
On Feb 19, 11:06 am, "Gimp" wrote:
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.... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Checking and Unchecking CheckBoxes in code | Excel Discussion (Misc queries) | |||
vba code to access checkboxes within groups? | Excel Programming | |||
checkboxes and code | Excel Programming | |||
Adding checkboxes via code to a workheet | Excel Programming | |||
Making All Checkboxes Run the Same Code | Excel Programming |