Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-30-2014, 05:40 PM
worder worder is offline how to show total of check boxes checked Windows 7 64bit how to show total of check boxes checked Office 2010 32bit
Novice
how to show total of check boxes checked
 
Join Date: Jan 2014
Posts: 7
worder is on a distinguished road
Default how to show total of check boxes checked

I have a row of 18 checkboxes and I would like to display a percentage of checkboxes checked to the right of the row. So if nine boxes were checked the percentage would show 50%.


Thanks in advance.
Reply With Quote
  #2  
Old 01-30-2014, 10:42 PM
macropod's Avatar
macropod macropod is offline how to show total of check boxes checked Windows 7 32bit how to show total of check boxes checked Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

What kind of checkboxes (e.g. userform, formfield, content control, Active-X)?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 03-07-2014, 11:17 PM
worder worder is offline how to show total of check boxes checked Windows 7 64bit how to show total of check boxes checked Office 2010 32bit
Novice
how to show total of check boxes checked
 
Join Date: Jan 2014
Posts: 7
worder is on a distinguished road
Default

I used developer design mode.
But if you have an easier way, I'm open to suggestion as it doesn't really matter.
Reply With Quote
  #4  
Old 03-07-2014, 11:22 PM
macropod's Avatar
macropod macropod is offline how to show total of check boxes checked Windows 7 32bit how to show total of check boxes checked Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

All three kinds are accessed via the Developer tab, so telling me that's what you're using isn't telling me anything about what kind they are...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 03-08-2014, 11:16 PM
worder worder is offline how to show total of check boxes checked Windows 7 64bit how to show total of check boxes checked Office 2010 32bit
Novice
how to show total of check boxes checked
 
Join Date: Jan 2014
Posts: 7
worder is on a distinguished road
Default

I don't know how to find that out.
It was a while ago when I created it.
I think it is an active x control.
When I click on PROPERTIES, it doesn't tell me what it is.
Reply With Quote
  #6  
Old 03-08-2014, 11:19 PM
macropod's Avatar
macropod macropod is offline how to show total of check boxes checked Windows 7 32bit how to show total of check boxes checked Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Without knowing for sure what you've used, one could spend a lot of time working on the right solution for the wrong kind of checkbox. Can you attach a document to a post with the checkboxes in question (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 03-09-2014, 11:23 AM
worder worder is offline how to show total of check boxes checked Windows 7 64bit how to show total of check boxes checked Office 2010 32bit
Novice
how to show total of check boxes checked
 
Join Date: Jan 2014
Posts: 7
worder is on a distinguished road
Default

attached as requested
Attached Files
File Type: doc temp.doc (86.0 KB, 42 views)
Reply With Quote
  #8  
Old 03-09-2014, 02:43 PM
macropod's Avatar
macropod macropod is offline how to show total of check boxes checked Windows 7 32bit how to show total of check boxes checked Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your checkboxes are indeed of the Active-X type. To get the desired tally you could use a macro like:
Code:
Sub CountChecks()
Dim iShp As InlineShape, i As Long, j As Long, StrPct As String
For Each iShp In ActiveDocument.InlineShapes
  If Not iShp.OLEFormat Is Nothing Then
    If iShp.OLEFormat.ClassType = "Forms.CheckBox.1" Then
      i = i + 1
      If iShp.OLEFormat.Object.Value = True Then j = j + 1
    End If
  End If
Next
If i <> 0 Then
  StrPct = " (i.e. " & Format(j / i, "0.0%") & ")"
End If
MsgBox j & " of " & i & " checkboxes" & StrPct & " are checked."
End Sub
For macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 03-09-2014, 09:46 PM
worder worder is offline how to show total of check boxes checked Windows 7 64bit how to show total of check boxes checked Office 2010 32bit
Novice
how to show total of check boxes checked
 
Join Date: Jan 2014
Posts: 7
worder is on a distinguished road
Default

Would I have to click a macro button to get the total?
I was actually looking for a solution whereby the total was automatically updated when a box was checked.
Reply With Quote
  #10  
Old 03-09-2014, 09:55 PM
macropod's Avatar
macropod macropod is offline how to show total of check boxes checked Windows 7 32bit how to show total of check boxes checked Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Yes, you could do that. For example, if you go into Design Mode and double-click on your last checkbox, the VBE will open up with a sub named 'Checkbox117_Click()'. If you edit that so it reads:
Code:
Private Sub Checkbox117_Click()
Call CountChecks
End Sub
and add the CountChecks macro from my previous post to the same code module, the macro will run any time that checkbox is clicked.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 03-09-2014, 10:54 PM
fumei fumei is offline how to show total of check boxes checked Windows 7 64bit how to show total of check boxes checked Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

As you can see, that means that the code runs if THAT checkbox is clicked. If you want
Code:
 whereby the total was automatically updated when a box was checked.
that is, when ANY checkbox is changed, you need to add code to do that for ALL of them. Otherwise, yes, you need to "manually" execute the code.
Reply With Quote
  #12  
Old 03-09-2014, 10:58 PM
macropod's Avatar
macropod macropod is offline how to show total of check boxes checked Windows 7 32bit how to show total of check boxes checked Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Or you could add an ActiveX command button to the document and run the macro from that. So many possibilities ...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #13  
Old 03-09-2014, 11:02 PM
fumei fumei is offline how to show total of check boxes checked Windows 7 64bit how to show total of check boxes checked Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

I was actually thinking of a commandbutton beside them, and that this is a "manual" execution, as you have to DO something. Personally, I think I would use a simple keyboard shortcut to run the code. And I would put the content (the text of the percentage) into a textbox, or a bookmark.
Reply With Quote
  #14  
Old 03-09-2014, 11:15 PM
worder worder is offline how to show total of check boxes checked Windows 7 64bit how to show total of check boxes checked Office 2010 32bit
Novice
how to show total of check boxes checked
 
Join Date: Jan 2014
Posts: 7
worder is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Yes, you could do that. For example, if you go into Design Mode and double-click on your last checkbox, the VBE will open up with a sub named 'Checkbox117_Click()'. If you edit that so it reads:
Code:
Private Sub Checkbox117_Click()
Call CountChecks
End Sub
and add the CountChecks macro from my previous post to the same code module, the macro will run any time that checkbox is clicked.
Ok ... I added your subroutine and a sub for each checkbox as you suggested ... now how do I display the total / percent ?
Your method works perfectly but uses a pop-up.
My objective was to put a running total / percent to the right of all the check boxes.
Reply With Quote
  #15  
Old 03-10-2014, 03:43 AM
macropod's Avatar
macropod macropod is offline how to show total of check boxes checked Windows 7 32bit how to show total of check boxes checked Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

If you create a textbox for the output to go to, you could change 'MsgBox ' to:
'ActiveDocument.Shapes(1).TextFrame.TextRange.Text = '
It would be better, though, to put your checkboxes into a 2-column, 1-row table, so the output can be sent to the second cell in the table. That's because the above method relies on the textbox being the first logical one in the document, whereas a table reference can be made more specific.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
check box percentage

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to show total of check boxes checked Repeat Spell check in a doc that has already been checked mawigfie Word 1 08-22-2012 01:16 PM
Word2010 check boxes and plain text content control boxes in same table fcsungard Word 5 06-01-2012 01:16 AM
Create makro that counts the number of checked tick boxes in a survey johannapaj Word VBA 0 09-05-2011 01:51 AM
how to show total of check boxes checked I Checked "Don't show again" and now I want it back. WaltR Word 1 02-03-2011 03:20 AM
Problem with Developer Form -- Check Boxes and Text Boxes PCC Word 1 05-16-2009 05:22 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft