Need to edit string in cell

J

jorlypong

I am learning some vba and am trying to delete some useless info both before
and after my needed info (job #)

ex. "hello:07-021 goodbye"

I need to have the "hello:" and " goodbye" leaving only the job number.
Note: all the job numbers start with two digits, have a hyphen, and end with
three digits such as "00-000"

Any help would be great . . . thank you
 
R

Rick Rothstein

If your text can **never** have a hyphen in **front** of the job number,
then you can do this..

Text = "hello:07-021 goodbye"
JobNum = Mid(Text, InStr(Text, "-") - 2, 6)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top