Select the product you need help with
How to use Visual Basic for Applications to count the occurrences of a character in a selection in ExcelArticle ID: 89794 - View products that this article applies to. This article was previously published under Q89794 On This PageSUMMARY
In Microsoft Excel, you can use a macro to count the occurrences of a
specific character in a cell or range of cells. This article contains
a sample macro to count the occurrences of a specific character in a
cell or range of cells.
You can also use a formula to accomplish the task. If you prefer not to use a macro, click the following article numbers to view the articles in the Microsoft Knowledge Base: 187667
(http://support.microsoft.com/kb/187667/
)
Formulas to count the occurrences of text, characters, or words in Excel for Mac
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. Sample Visual Basic procedureThe following Visual Basic procedure prompts you for a character (or characters), then searches through the currently selected cell, or range of cells, and displays a message box showing the total number of occurrences of that character or character string. This works for all alphanumeric characters.REFERENCES
For more information about how to obtain help with Visual Basic for Applications, click the following article numbers to view the articles in the Microsoft Knowledge Base:
305326
(http://support.microsoft.com/kb/305326/
)
List of programming resources for Visual Basic for Applications
226118
(http://support.microsoft.com/kb/226118/
)
List of resources that are available to help you learn Visual Basic for Applications programming
163435
(http://support.microsoft.com/kb/163435/
)
Programming resources for Visual Basic for Applications
PropertiesArticle ID: 89794 - Last Review: September 19, 2011 - Revision: 8.0 APPLIES TO
| Article Translations
|


Back to the top








