Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Summation of cells tied to Checkboxes

Hello,

I think I'm fairly close to solving this problem, but I'm havin
trouble grasping a key concept:

What I would like to be able to do is sum cells based on checkboxe
whose value is true and do nothing
if the checkboxes are not checked.

I have 29 Checkboxes i.e. CheckBox1...CheckBox29.

What I'm not sure how to do is associate each CheckBox with a specifie
cell.

For example:

CheckBox1 is tied to Cell M12
...
CheckBox29 is tied to Cell M40.

Therefore, I'm trying to write code so that only the Checkboxes whos
values are True, then their associated cells are summed.


My code so far:


Sub Checkboxcount
Dim Counter as Integer

For x = 1 to 29
IF CheckBox(x) = TRUE THEN
Counter = Counter + 1

END IF
NEXT X
END SUB


Another question is how do I direct the output of this summation o
checked cells. I would like it directed just to a single cell.

Thanks for any help I can get.

Cheer

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Summation of cells tied to Checkboxes

Hi,
I think I'm fairly close to solving this problem, but I'm having
trouble grasping a key concept:

What I would like to be able to do is sum cells based on checkboxes
whose value is true and do nothing
if the checkboxes are not checked.

I have 29 Checkboxes i.e. CheckBox1...CheckBox29.

What I'm not sure how to do is associate each CheckBox with a specified
cell.

For example:

CheckBox1 is tied to Cell M12
..
CheckBox29 is tied to Cell M40.

Therefore, I'm trying to write code so that only the Checkboxes whose
values are True, then their associated cells are summed.


Another question is how do I direct the output of this summation of
checked cells. I would like it directed just to a single cell.


try this:

Sub SumCheckBoxes()
Dim obj As OLEObject
Dim dblValue As Double

For Each obj In ActiveSheet.OLEObjects
If obj.progID = "Forms.CheckBox.1" And obj.Object.Value Then
dblValue = dblValue + Range _
("M" & VBA.Replace(obj.Name, "CheckBox", "") + 11).Value
End If
Next obj

MsgBox dblValue
End Sub

--
Mit freundlichen Grüssen

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)
#Excel-Auftragsprogrammierung#

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Summation of cells tied to Checkboxes

Thanks,

I tried your suggestion. It worked perfectly!

Greatly appreciate it.

Cheer

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Summation of cells tied to Checkboxes

Thanks,

I tried your suggestion. It worked perfectly!

Greatly appreciate it.


thanks for your feedback:-)

--
Regards

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)

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
Checkboxes in cells Tim Childs[_2_] Excel Discussion (Misc queries) 2 December 12th 08 07:02 AM
Is there a way of copying summation or count of highlighted cells? Mohan Excel Discussion (Misc queries) 0 October 3rd 08 10:01 AM
summation to show at the bottom when I highlight selected cells? Joyousmarie Excel Worksheet Functions 2 February 16th 07 05:32 PM
Cells as checkboxes? Austin Excel Discussion (Misc queries) 10 November 18th 05 06:19 AM
Selected cells: item count versus summation Neal Zimm Excel Discussion (Misc queries) 3 October 9th 05 02:30 PM


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

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

About Us

"It's about Microsoft Excel"