testing for a string type

  • Thread starter Thread starter 6e
  • Start date Start date
6

6e

hi!

Im working with the selection object.

what I would like to do is test to make sure that the object's value is
a string object, and if it isn't I would like to skip some
functionality.

so....

If (Selection.Value IS A STRING") Then ' HELP! how do I
do this?
strFindText = Selection.Value
Else
'nothing, dont change value
End If
 
Hi

Would this be acceptable?
Sub if_string()
'Assuming data is a column a
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For i = 1 To rowcount
Range("a" & i).Select
If Application.IsText(ActiveCell) = True Then
'do something
MsgBox "a"
Else
'do something different
End If
Next
End Sub
 
Back
Top