ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I, in VBA, test to see if a cell has a specific word in it (https://www.excelbanter.com/excel-programming/430191-how-do-i-vba-test-see-if-cell-has-specific-word.html)

The Inspector

How do I, in VBA, test to see if a cell has a specific word in it
 

I need to know what text is in an cell. The cell will be used to determine
what sheet will be edited with the macro.

Don Guillett

How do I, in VBA, test to see if a cell has a specific word in it
 


A bit more info
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"The Inspector" <The
wrote in message
...
I need to know what text is in an cell. The cell will be used to determine
what sheet will be edited with the macro.



Brad

How do I, in VBA, test to see if a cell has a specific word in it
 

Sub SelectSheet()
If ActiveCell.Value = MyValue Then
Sheets("MyValue").Select
Else
Sheets("NotMyValue").Select
End If
End Sub

Hope this helps.

"The Inspector" wrote:

I need to know what text is in an cell. The cell will be used to determine
what sheet will be edited with the macro.


Patrick Molloy

How do I, in VBA, test to see if a cell has a specific word in it
 

do you mean

If ActiveCell.Value = "MyValue" Then

otherwise MyValue becomes a variable, defaulting to null and the IF
condition will always be False

"Brad" wrote in message
...
Sub SelectSheet()
If ActiveCell.Value = MyValue Then
Sheets("MyValue").Select
Else
Sheets("NotMyValue").Select
End If
End Sub

Hope this helps.

"The Inspector" wrote:

I need to know what text is in an cell. The cell will be used to
determine
what sheet will be edited with the macro.



The Inspector[_2_]

How do I, in VBA, test to see if a cell has a specific word in
 

Thanks guys

"Patrick Molloy" wrote:

do you mean

If ActiveCell.Value = "MyValue" Then

otherwise MyValue becomes a variable, defaulting to null and the IF
condition will always be False

"Brad" wrote in message
...
Sub SelectSheet()
If ActiveCell.Value = MyValue Then
Sheets("MyValue").Select
Else
Sheets("NotMyValue").Select
End If
End Sub

Hope this helps.

"The Inspector" wrote:

I need to know what text is in an cell. The cell will be used to
determine
what sheet will be edited with the macro.




All times are GMT +1. The time now is 12:47 PM.

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