Associate values checkbox and sum

jmaocubo

New Member
Joined
Apr 7, 2010
Messages
25
Hi!!!

I've a userform with 5 checkboxes and 1 botton

i need that every checkbox has a number associated so when i click in botton1

those values sum

e.g.: associate value 5 to checkbox1, 3 to checkbox2 and 10 to checkbox3, 4 to checkbox4, 13 to checkbox5

if i enable checkbox1 and checkbox2 in sheet("auxiliar").range("E5")=(5+10) after click botton1.

thanks in advance
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
found it....

Code:
Option Explicit 
  ' GTO (helper)
Private Sub CommandButton1_Click() 
    Dim lVal As Long 
     
    With Me 
        lVal = Abs(.CheckBox1.Value * 5) _ 
        + Abs(.CheckBox2.Value * 3) _ 
        + Abs(.CheckBox3.Value * 10) _ 
        + Abs(.CheckBox4.Value * 4) _ 
        + Abs(.CheckBox5.Value * 13) 
    End With 
     
    ThisWorkbook.Worksheets("auxiliar").Cells(5, 5).Value = lVal 
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top