ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   testing for a string type (https://www.excelbanter.com/excel-programming/367842-testing-string-type.html)

6e

testing for a string type
 
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


jetted[_13_]

testing for a string type
 

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


--
jetted
------------------------------------------------------------------------
jetted's Profile: http://www.excelforum.com/member.php...o&userid=17532
View this thread: http://www.excelforum.com/showthread...hreadid=563386



All times are GMT +1. The time now is 09:58 AM.

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