ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Text Sub (https://www.excelbanter.com/excel-programming/324363-text-sub.html)

Ronbo

Text Sub
 
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.

Tom Ogilvy

Text Sub
 
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


--
Regards,
Tom Ogilvy


"Ronbo" wrote in message
...
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.




Ronbo

Text Sub
 
Tom, as always... thanks alot for your help.

Regards,
Ronbo

"Tom Ogilvy" wrote:

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


--
Regards,
Tom Ogilvy


"Ronbo" wrote in message
...
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.





gocush[_29_]

Text Sub
 
Sub Test1()
If Application.WorksheetFunction.IsText(Range("A1")) Then
MsgBox "It's text type"
routine A
Else
routine B
End If

End Sub

"Ronbo" wrote:

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.



All times are GMT +1. The time now is 04:14 PM.

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