Thread: extract text
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Steve Garman Steve Garman is offline
external usenet poster
 
Posts: 107
Default extract text

Are you looking for something like this?

Sub test()
MsgBox cash$("aif2ffsdfij$39.99&3kgjcism")
MsgBox cash$("qe141$29.99.cw.e.3312")
End Sub

Function cash$(s$)
Dim pos1%, pos2%
pos1% = InStr(1, s$, "$")
pos2% = InStr(pos1%, s$, ".")
cash$ = Mid$(s$, pos1%, pos2% + 3 - pos1%)
End Function


choice wrote:
if i have different text strings, but in all of them there will by a dollar amount.

example:
aif2ffsdfij$39.99&3kgjcism
or
qe141$29.99.cw.e.3312

how would i go about extracting the formula