Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Use a checkbox to change calculations


Hello,
I want to use a checkbox on a worksheet to change the calculation of all the
rows in a column.
Example:
Column A
1
2
3
4
5
If I check the check box I want to mutiply each number by 10. If I uncheck
it I want to devide each number by 10.
I am a novice at programing in Excel so any help will be great.
Thank You
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Use a checkbox to change calculations

Hi

Insert a checkbox from the Command Toolbox menu, and right click on
the checkbox. Select "View code". Inset the code below into the code
sheet.
Exit design mode. Enter "10" in B1 and test it:


Private Sub CheckBox1_Change()
TargetCol = "A"
Range("B1").Copy

If Me.CheckBox1.Value = True Then
Columns(TargetCol).PasteSpecial Paste:=xlAll,
Operation:=xlMultiply
Else
Columns(TargetCol).PasteSpecial Paste:=xlAll, Operation:=xlDivide
End If
End Sub

Regards,
Per


On 9 Dec., 15:29, Cmenkedi wrote:
Hello,
I want to use a checkbox on a worksheet to change the calculation of all the
rows in a column.
Example:
Column A
1
2
3
4
5
If I check the check box I want to mutiply each number by 10. If I uncheck
it I want to devide each number by 10.
I am a novice at programing in Excel so any help will be great.
Thank You


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Use a checkbox to change calculations


I'm having problems with the line:
If Me.CheckBox1.Value = True Then
When I compiled it, I received an error that says:
Invalid use of Me keyword.

Also I don't want to enter in the number in the spreadsheet, I want it to be
a constant that cannot be changed.

Thank you.

"Per Jessen" wrote:

Hi

Insert a checkbox from the Command Toolbox menu, and right click on
the checkbox. Select "View code". Inset the code below into the code
sheet.
Exit design mode. Enter "10" in B1 and test it:


Private Sub CheckBox1_Change()
TargetCol = "A"
Range("B1").Copy

If Me.CheckBox1.Value = True Then
Columns(TargetCol).PasteSpecial Paste:=xlAll,
Operation:=xlMultiply
Else
Columns(TargetCol).PasteSpecial Paste:=xlAll, Operation:=xlDivide
End If
End Sub

Regards,
Per


On 9 Dec., 15:29, Cmenkedi wrote:
Hello,
I want to use a checkbox on a worksheet to change the calculation of all the
rows in a column.
Example:
Column A
1
2
3
4
5
If I check the check box I want to mutiply each number by 10. If I uncheck
it I want to devide each number by 10.
I am a novice at programing in Excel so any help will be great.
Thank You



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Use a checkbox to change calculations


I got it to compile but when I try to run it, it tells me "Object Required".
Thanks


"Cmenkedi" wrote:

I'm having problems with the line:
If Me.CheckBox1.Value = True Then
When I compiled it, I received an error that says:
Invalid use of Me keyword.

Also I don't want to enter in the number in the spreadsheet, I want it to be
a constant that cannot be changed.

Thank you.

"Per Jessen" wrote:

Hi

Insert a checkbox from the Command Toolbox menu, and right click on
the checkbox. Select "View code". Inset the code below into the code
sheet.
Exit design mode. Enter "10" in B1 and test it:


Private Sub CheckBox1_Change()
TargetCol = "A"
Range("B1").Copy

If Me.CheckBox1.Value = True Then
Columns(TargetCol).PasteSpecial Paste:=xlAll,
Operation:=xlMultiply
Else
Columns(TargetCol).PasteSpecial Paste:=xlAll, Operation:=xlDivide
End If
End Sub

Regards,
Per


On 9 Dec., 15:29, Cmenkedi wrote:
Hello,
I want to use a checkbox on a worksheet to change the calculation of all the
rows in a column.
Example:
Column A
1
2
3
4
5
If I check the check box I want to mutiply each number by 10. If I uncheck
it I want to devide each number by 10.
I am a novice at programing in Excel so any help will be great.
Thank You



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
Checkbox Name Change? J.W. Aldridge Excel Programming 3 August 10th 07 12:10 AM
checkbox value change pv78 Excel Programming 4 August 16th 06 04:49 PM
Using a checkbox to change a formula Giselle[_2_] Excel Programming 1 March 14th 06 12:59 AM
How do I change the appearance of a checkbox Christine Excel Discussion (Misc queries) 2 February 23rd 06 08:43 PM
CheckBox Change Event Soniya[_4_] Excel Programming 2 April 26th 05 02:18 PM


All times are GMT +1. The time now is 03:43 PM.

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"