Excel VBA and cell value

I have a variable on a sheet that changes based on the row being read while the loop is executed.

Dim rowIndex as Integer
Dim SourceRange as Variant
SourceRange = ("A2")

In the loop I have this;
SourceRange = ("A") & rowIndex

The SourceRange is changing properly as the loop is executed, BUT,

I am trying to figure out of the variable SourceRange contains a string.  How do I get that value from SourceRange?  

TechPilot9133IS Operations LeadAsked:
Who is Participating?
Martin LissConnect With a Mentor Older than dirtCommented:
Dim SourceRange as Range
SourceRange = ("A2")
MsgBox SourceRange.Value
You could try something like this:-

If Application.WorksheetFunction.IsText(SourceRange) = True Then

----->do something here

End If

Hope this helps,
Actually, this is better:-

If VarType(SourceRange) = vbString Then

---->Do something here

End If

TechPilot9133IS Operations LeadAuthor Commented:
That answer does exactly what I asked, but it does not help me whith what I am trying to do.  I will do further tests and hopefully formulate my question better.  Sometimes finding the proper way to ask the question is the harder than us newbs think. Thank you for the responses.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.