Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-04-2015, 06:22 AM
gmayor's Avatar
gmayor gmayor is offline Macro to check dropdown value and increment a counter Windows 7 64bit Macro to check dropdown value and increment a counter Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

While what you ask is possible. It requires a lot of error checking to ensure that the count is a true reflection of the selections. It requires the user to tab through each to increment the values. Simply leaving the values at their defaults will not increment the count.

I believe it would make more sense to use a macro to count the values after they have all been completed. That way there should be no false values. e.g.

Code:
Sub CountValues()
Dim A_Count As Long
Dim B_Count As Long
Dim C_Count As Long
Dim oFF As FormField
    A_Count = 0
    B_Count = 0
    C_Count = 0
    For Each oFF In ActiveDocument.FormFields
        If oFF.Type = wdFieldFormDropDown Then
            Select Case oFF.Result
                Case "A": A_Count = A_Count + 1
                Case "B": B_Count = B_Count + 1
                Case "C": C_Count = C_Count + 1
                Case Else
            End Select
        End If
    Next oFF
    MsgBox "A - Selected " & A_Count & vbCr & _
           "B - Selected " & B_Count & vbCr & _
           "C - Selected " & C_Count
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Tags
bookmarks, word 2003, word vba macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown list, Macro shield5 Excel Programming 7 10-27-2013 01:51 AM
Macro to check dropdown value and increment a counter macro not working (on click increment) gsrikanth Excel Programming 1 07-12-2012 07:40 AM
Check box macro help needed Aflac Word 4 03-24-2012 07:11 PM
Macro to populate a text form field based on dropdown selection koloa Word 0 10-20-2011 11:52 AM
Macro to check dropdown value and increment a counter Check Box Macro Johnny thunder Word VBA 12 04-07-2011 04:47 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:19 AM.


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