strip value

RompStar

Well-known Member
Joined
Mar 25, 2005
Messages
1,200
my file name convention is: Store_number_restoffilenameblablabla.xls

example:

Store_43_July2011.xls

I need to strip the store number, just not sure how to do that using the InStr function, or whatever is the best way, need it to work in VBA, thank you!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
You can use split...

FleNm = "Store_number_restoffilenameblablabla.xls"
MyStore = Split(FleNm,"_")(0)
 
Upvote 0
Hi there, I tried the example, the string that I got back was "Store", but I need the Store number: 43 in my example
 
Upvote 0
this worked!

FleNm = "Store_24_restoffilenameblablabla.xls"
MyStore = Split(FleNm, "_")(1)

Thanks! A LOT!
 
Upvote 0
oh, yes...

Split makes an array of all the values deliminated by the _

0 is the first
1 is the 2nd
2 is the 3rd
etc..
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,633
Members
452,933
Latest member
patv

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