ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   removing certain text from a string (https://www.excelbanter.com/excel-programming/338751-removing-certain-text-string.html)

Papa Jonah

removing certain text from a string
 
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

Tom Ogilvy

removing certain text from a string
 
Sub TTT()
sStr = "xxx-xx-xxx-xxxxxyyyyy-nnnn-nnnn"
v = Split(sStr, "-")
MsgBox v(3)
End Sub

Requires xl2000 or later
--
Regards,
Tom Ogilvy


"Papa Jonah" wrote in message
...
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





All times are GMT +1. The time now is 01:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com