Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking and Unchecking CheckBoxes in code Ayo Excel Discussion (Misc queries) 0 April 3rd 09 08:41 PM
vba code to access checkboxes within groups? [email protected][_2_] Excel Programming 1 October 19th 05 09:40 PM
checkboxes and code Soniya[_4_] Excel Programming 3 April 24th 05 01:08 PM
Adding checkboxes via code to a workheet Stef Excel Programming 0 February 1st 05 02:51 PM
Making All Checkboxes Run the Same Code MT DOJ Help Desk[_3_] Excel Programming 5 May 12th 04 06:24 AM


All times are GMT +1. The time now is 08:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"