Your explanation suggests all text you need to extract from will be the
same before/after 'THISISTHETEXTINEED'. Given the likelihood that the
filenames will be different lengths you'll need to take a more reliable
approach such as using VBA would offer. This will also address your
'value' issue as it can put the resulting extracted text into a cell's
Value property as preferred...
Sub Extract_ImageFilename()
Dim vData, rng
For Each rng In Selection
vData = Split(rng, "/"): rng.Offset(0, 1) = vData(3)
Next 'rng
End Sub
...where the string is dumped into a zero-based array and the text to
extract (4th element) is put in the next column.
Since you say there are thousands to process, this will take some time
reading/writing one cell at a time. I'd consider dumping the entire
list into an array, build an output array in memory, then dump that
into the next column...
Sub Extract_ImageFilename2()
Dim vDataIn, vDataOut(), n&
vDataIn = Selection: ReDim vDataOut(1 To UBound(vDataIn))
For n = 1 To UBound(vDataIn)
vDataOut(n) = Application.Index(Split(vDataIn(n, 1), "/"), 4)
Next 'rng
Selection.Offset(, 1).Value = vDataOut
End Sub
...where each cell's content is put into a one-based output array and
the text to extract (4th element) is put into its respective position
in the output array.
HTH
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion