testing for a string type

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
 
J

jetted

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top