Thread: number
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kevin Sprinkel Kevin Sprinkel is offline
external usenet poster
 
Posts: 14
Default 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
.