View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default VB Code for summing control check boxes

I assume the checkbox names are checkbox1, checkbox2 and so on..Launch VBE
using Alt+F11. Insert a module and paste the below code..

In worksheet the below formula will return the value
=GetCheckBoxValue()

Function GetCheckBoxValue() As Long
For intTemp = 1 To 4
If ActiveSheet.OLEObjects("CheckBox" & intTemp).Object.Value = True Then
GetCheckBoxValue = GetCheckBoxValue + 1
End If
Next
End Function
--
If this post helps click Yes
---------------
Jacob Skaria


"Leigh Douglass" wrote:

HI

I have a sheet with 4 tick box controls on it, i would like a peice of vb
code that would add them up if they have a check in them. I have no idea
where to start.

Thanks in advance for the help.

Leigh