VBA to extract string between 2 special characters (where spec. characters appear twice)

Sah213

New Member
Joined
Feb 25, 2014
Messages
10
I'm looking for some VBA to extract the text: 1620011017 from the below string;

Inv_1620056384_1620011017_1034258

There could be any number of characters, so I think I would need to define it based on the fact it's the string between the 2 underscores.
I think starting from the right of the string would be easiest as starting from the left it's the 2nd string between the _ characters. Starting from the right, it's the first string that meets that criteria.

If anyone could help with their expertise, I'd really appreciate it!
 
Hey Joe why a formula - static - while the initial post requires « some VBA » ?!​
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Sorry, missed the part about VBA.
 
Upvote 0
Can be useful if its VBA procedure reads your formula result from a cell …​
 
Upvote 0
Thanks !​
Post #4 is from the left and the post #6 variation is from the right …​
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,575
Members
449,089
Latest member
Motoracer88

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