The information in this article applies to:
SUMMARYIn Microsoft Excel, you can count the number of cells in a worksheet that contain formulas, text, or numbers, by using the Go To Special dialog box (versions 5.0 and later) or the Select Special dialog box (versions 4.0 and earlier) to select the cells and then running a macro that counts the number of selected cells. MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.asp Selecting the CellsFollow the appropriate procedure below to select formulas, text, or numbers.Microsoft Excel Versions 5.0 and Later:
Running a Macro to Count the Selected CellsVisual Basic Procedure for Versions 5.0 and Later:The following procedure counts the number of cells in the selection and displays the result in a message box:
Microsoft Excel Macro for Versions 4.0 and Earlier:
The following macro counts the number of cells selected and displays the result in an Alert dialog box:
Following is an explanation of the preceding macro:
A1: Contains the name of the macro. REFERENCES
"User's Guide 2," version 4.0, pages 203-204 Additional query words: 4.00a 8.00 XL98 XL97 XL7 XL5 XL4 XL3
Keywords : kbprg kbdta kbdtacode PgmHowto KbVBA kbhowto |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |