Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

excel vba

ResolvedVersion 2007

Steve has attended:
Excel VBA Intro Intermediate course

Excel VBA

What is the best way to find a particular word in a string. The word always appears as the last word but the string length does vary. For example, how would I find the word "Total" in the below examples:

"Euro Conversion Total"
"Conversion Total"

I have tried using the "Instr" function but I am only able to get this to work if the target word appears at the front of the string:

If InStr(1, i, "Total", vbBinaryCompare) = 1 Then

Thanks

RE: Excel VBA

Hello Steve,

You may try using the wildcard in the criteria, such as "*total" to find anything that ends in total, or "*total*" to find it anywhere.

I hope this resolves your question. If it has, please mark this question as resolved.

If you require further assistance, please reply to this post. Or perhaps you have another Microsoft Office question?

Have a great day.
Regards,

Mark
Microsoft Office Specialist Trainer

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Remove unused toolbar buttons

Are there buttons on your Excel toolbars that you never use? Remove them from the toolbar by doing the following:

1. Go to Tools - Customise - Commands.
2. Select the toolbar button you wish to remove, then use your mouse to drag and drop the button into the Excel window. When you release your finger from the mouse, the button will disappear.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.