Text Sub

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need help creating a sub that checks "A1" to see if it has text in the
cell, and if so run routine A Else routine B.

Any help is always appreciated.
 
Sub Main
if Worksheets("Sheet1").Range("A1").Value <> "" then
routineA
else
routineB
end if
End Sub

this runs routineA if A1 is not empty. If you want to check for a specific
value replace with

if Worksheets("Sheet1").Range("A1").Value = "ABCD" then
 
Sub Test1()
If Application.WorksheetFunction.IsText(Range("A1")) Then
MsgBox "It's text type"
routine A
Else
routine B
End If

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

Back
Top