ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Search array for string (https://www.excelbanter.com/excel-programming/443294-search-array-string.html)

navin

Search array for string
 
Hi all,

Is there a function in vba to search occurrence of a letter and return
its index?
I need to find the first and nth index of a character in an array.

Array: (****+++++++**)

I need to find out the first occurrence of + and last occurrence of +
in the array. I got the result by looping thru the array but was
hoping
to find out a smaller function to achieve this.

Thanks for the help.

Navin

Dave Peterson[_2_]

Search array for string
 
If you're really looking through a string -- not an array, you could use VBA's
Instr to find the first position.

And if you're using xl2k or higher, you could use RevInStr to find the last
position.



On 07/05/2010 05:51, navin wrote:
Hi all,

Is there a function in vba to search occurrence of a letter and return
its index?
I need to find the first and nth index of a character in an array.

Array: (****+++++++**)

I need to find out the first occurrence of + and last occurrence of +
in the array. I got the result by looping thru the array but was
hoping
to find out a smaller function to achieve this.

Thanks for the help.

Navin


--
Dave Peterson


All times are GMT +1. The time now is 04:54 AM.

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