ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   number (https://www.excelbanter.com/excel-programming/300353-number.html)

Sam

number
 
i want to check to see if a cell or a number of cells
contain a number or a string. can anyone help me with
that?

thanx a lot

Kevin Sprinkel

number
 
You can use the IsNumeric function to determine if the
expression in the cell can be evaluated to a number, and
the For..Next construction to loop through all cells in
the selected range. For example, the following counts the
number of numeric cells in the range and displays a
message box with the result:

Sub CountNumeric()
Dim Cell As Range
Dim intCount As Integer
intCount = 0
For Each Cell In Selection
If IsNumeric(Cell) Then
intCount = intCount + 1
End If
Next
MsgBox "There are " & intCount & " numeric cells in the
selected range."
End Sub

HTH
Kevin Sprinkel

-----Original Message-----
i want to check to see if a cell or a number of cells
contain a number or a string. can anyone help me with
that?

thanx a lot
.



All times are GMT +1. The time now is 11:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com