Choose Certain Words In An If Statement

charllie

Well-known Member
Joined
Apr 6, 2005
Messages
986
Hi Folks,

I have a textbox in a userform that will be the title of certains DVD's etc. I want to be able to identify certain words within that title.

For Example:

DVD title is "The Star Trek First Edition"
I want to be able to just pick up on the words "Star Trek" so if a sentance contains these words i can perform certain actions.

I can use the following code which does work if the words "Star Trek" only are used.

Code:
If Me.TextBox14.Text = "Star Trek" Then
        Me.TextBox10.Text = "10"
    Else
        Me.TextBox10.Text = "20"
    End If
Can anyone help me with this please, is it possible or isthere another way around it?

Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
If instr(Me.TextBox14.Text,"Star Trek") <> 0 Then
Me.TextBox10.Text = "10"
Else
Me.TextBox10.Text = "20"
End If
 
Upvote 0
Hi Ooang,

Thank you very much for the code, that woks just as required.

I appreciate your help.

Thanks
 
Upvote 0

Forum statistics

Threads
1,203,238
Messages
6,054,312
Members
444,715
Latest member
GlitchHawk

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top