Can VBA grab multiple integers from a string?

Sadsmileyface

New Member
Joined
Mar 21, 2013
Messages
11
I have a string which will include text, numbers and punctuation. It's free text so it's never constructed in a consistent fashion. Within that string, there will occur 4x 5-digit integers. Sometimes the integer will be preceded by a space or a symbol (like " 12345" or ":12345" or "-12345" etc) depending on how the user chose to write it. The only thing we know for sure it that 5-digit numbers will appear 4 separate times.


Would it be possible to use VBA to interrogate that string, then identify each of those 4 5-digit integers, then store them in separate columns on the spreadsheet? For simplicity, imagine cells A1:D1 being populated with each of the four integers.


As always, any insights are extremely appreciated.
 
Thanks Pgc, wrote some notes on this as I find it really interesting! Your time has been much appreciated. :)
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,215,356
Messages
6,124,475
Members
449,164
Latest member
Monchichi

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