removing certain text from a string

P

Papa Jonah

I have a column of report designators that consist of a bunch of text
separated by hyphens
xxx-xx-xxx-xxxxxyyyyy-nnnn-nnnn

I want to end up with the text in the middle to be copied to another column.
However, I can not (that I am aware of) use the mid function because the
length of the strings between the hyphens can vary.

Any suggestions would be greatly appreciated.
TIA
 
T

Tom Ogilvy

Sub TTT()
sStr = "xxx-xx-xxx-xxxxxyyyyy-nnnn-nnnn"
v = Split(sStr, "-")
MsgBox v(3)
End Sub

Requires xl2000 or later
 

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