Find a value in a cell and display LEN location??

Fyr

Active Member
Joined
Jan 20, 2009
Messages
375
I'll try my best to explain this.
I have CSV files that are opened and data is read for them.
I'm looking for a script that find's a certain value in cell "A1" and displays it's located by LEN.

So lets say cell "A1" contains

Code:
BDIR)\\HTO\ASERV30\IMG\IN\1119654652202BD000000001119654652202BTNB1119654652202BTRETCT9BTSRCASCAN BTTYOCFOCBN 1119654652202DREC20110714DTSCN20110714TSTESNMRD 052011

I want to find data "DTSCN". The script would return LEN 136.
Is this possible?
 
Last edited:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
That worked perfectly if I put it in a cell.
But how do I do that with VBA?

I know this is not right:
Search("DTSCN", Range("A1"))
 
Upvote 0
Try

Code:
MsgBox InStr([A1], "DTSCN")

Note that InStr is case sensitive so you may prefer

Code:
MsgBox InStr(UCase([A1]), "DTSCN")
 
Upvote 0
Thank you njimack that worked perfectly!!
jasonb75, that also worked! thank you!

:beerchug:
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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