excel vba

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Excel VBA

Excel VBA

resolvedResolved · High Priority · Version 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:

Using basic functions without doing formulas

When you highlight figures Autocalc tells you the total in the bottom right of the screen, but if you right click on the sum it will give you some basic functions. The functions are Min, Max, Average, Sum, Count, and Count Nums.

View all Excel hints and tips


Server loaded in 0.08 secs.