Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tkw tkw is offline
external usenet poster
 
Posts: 2
Default if a checkbox is checked then...

I am trying to write a code that will allow me to multiple one range by .15
- IF THE CHECKBOX IS CHECKED - and place the sum in another range. If not
checked then it will equal 0


If chkEligable.Value = True Then

Range ("Retirement") will equal .15 times Range ("Annual_Salary")

Else

Range("Retirement").Value = 0
Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default if a checkbox is checked then...

I assume the checkbox is on a sheet. Richt click on
the sheet tab and click "View Code" to open the sheet
code module. Then copy and past the code into the code
window. Also assumed you named the checkbox as shown.


Private Sub chkEligable_Click()
If chkEligable.Value = True Then
Range("Retirement") = 0.15*Range("Annual_Salary").Value
Else
Range("Retirement") = 0
End Sub



"tkw" wrote in message
...
I am trying to write a code that will allow me to multiple one range by .15
- IF THE CHECKBOX IS CHECKED - and place the sum in another range. If not
checked then it will equal 0


If chkEligable.Value = True Then

Range ("Retirement") will equal .15 times Range ("Annual_Salary")

Else

Range("Retirement").Value = 0
Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default if a checkbox is checked then...

with worksheets("Somesheetname")
If chkEligable.Value = True Then
.Range("Retirement").value = 0.15 * .Range("Annual_Salary").value
else
.range("Retirement").value = 0
end if
end with

I assumed that both the ranges are on the same sheet (named somesheetname).

And this doesn't check for any non-numerical data, either.

tkw wrote:

I am trying to write a code that will allow me to multiple one range by .15
- IF THE CHECKBOX IS CHECKED - and place the sum in another range. If not
checked then it will equal 0

If chkEligable.Value = True Then

Range ("Retirement") will equal .15 times Range ("Annual_Salary")

Else

Range("Retirement").Value = 0
Thanks


--

Dave Peterson
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
IF checkbox is checked/unchecked, Cell.value = yes/no James Excel Worksheet Functions 3 October 3rd 08 06:56 PM
How to have Checkbox A uncheck with checked Checkbox B Texas Aggie Excel Discussion (Misc queries) 3 July 20th 07 10:58 PM
Is checkbox is checked? Fred S Excel Discussion (Misc queries) 2 October 19th 05 03:53 AM
If Checkbox checked/notchecked then Darrin Henry[_2_] Excel Programming 2 April 13th 05 06:05 PM
checkbox - default checked or un-checked barrfly Excel Programming 1 December 22nd 03 05:00 PM


All times are GMT +1. The time now is 05:54 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"