Answered by:
VBA Word 2003

Question
-
How to formulate a macro that checks the value that a user selects from a dropdown box, then increments a counter depending on that value.
Each dropdown box/bookmark can have three values "Met", "Not Met", or "N/A". The macro will run "On exit" from the dropdown.
Pseudo code for this might look like -
Dim Cntr_Met, Cntr-Not, Cntr_NA as integer; (Initialized to 0)
If DrpDwn.Value = "Met"
Cntr_Met = Cntr_Met + 1
ElseIf
DrpDwn.Value = "Not Met"
Cntr_Not = Cntr_Not + 1
ElseIf
DrpDwn.Value = "N/A"
Cntr_NA = Cntr_NA + 1;
I am not asking you to do the work for me. If you can point me to sample code or good references where I can learn what I need, it will be of great help.
Thanks much,
Fergie
Sunday, January 4, 2015 4:19 AM
Answers
-
Hello,,,,
I do not know how much it will help in terms of coding part, but as per my knowledge, it is very simple,
Hence, you have to Set Unique value to each Data Filed in your DropDwonList control, instead of hard-core mentioned, (Initialized to 0),
Then on Slected_Changed Event you need to Increment that value by 1,
I hope this will workout for you, if not then please inform for the same.
Thanks,, :-)
- Marked as answer by Steve Fan Tuesday, January 27, 2015 1:37 AM
Friday, January 23, 2015 3:07 PM
All replies
-
Cross-posted (and answered) at: http://www.msofficeforums.com/word-vba/24158-macro-check-dropdown-value-increment-counter.html
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184Cheers
Paul Edstein
[MS MVP - Word]Sunday, January 4, 2015 10:08 PM -
Hi Fergie,
This forum is for general questions and feedback related to Word, programming related questions are best posed in one of the following 2 forums:
Microsoft Office Customization and Programming
http://answers.microsoft.com/en-us/office/forum/customize?page=1&tab=all
Outlook for Developers
http://social.msdn.microsoft.com/Forums/en-US/outlookdev
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Steve Fan
TechNet Community Support
It's recommended to download and install Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office programs.
Monday, January 5, 2015 1:33 AM -
Hello,,,,
I do not know how much it will help in terms of coding part, but as per my knowledge, it is very simple,
Hence, you have to Set Unique value to each Data Filed in your DropDwonList control, instead of hard-core mentioned, (Initialized to 0),
Then on Slected_Changed Event you need to Increment that value by 1,
I hope this will workout for you, if not then please inform for the same.
Thanks,, :-)
- Marked as answer by Steve Fan Tuesday, January 27, 2015 1:37 AM
Friday, January 23, 2015 3:07 PM -
Hello,,,,
I do not know how much it will help in terms of coding part, but as per my knowledge, it is very simple,
Hence, you have to Set Unique value to each Data Filed in your DropDwonList control, instead of hard-core mentioned, (Initialized to 0),
Then on Slected_Changed Event you need to Increment that value by 1,
I hope this will workout for you, if not then please inform for the same.
Thanks,, :-)
- Proposed as answer by Neelesh P Friday, January 23, 2015 3:13 PM
Friday, January 23, 2015 3:13 PM