Quote Originally Posted by kvsrinivasamurthy View Post
After this line

'Need to trim 'TheContent' here before passing to excel cell. Lets say 'TheContent' has a value "After Pickup $5,000 for drop to home". I need to pass only $5,000
Pl add this code


Dim T As Integer
Dim M As Variant

M = Split(TheContent, " ")

For T = 0 To UBound(M)
If InStr(1, M(T), "%") > 0 or InStr(1, M(T), "$") > 0 Then
TheContent = M(T)
Exit For
End If
Next T
Before this line

range.Cells(2, 9) = TheContent
This will extract words containing % or $.
This Code is working great. But i'm facing one problem here. Suppose if there is no space between $ value and the next word its not triming the $value alone.

For example consider there is a line "After Pickup $5,000for drop to home"

In the above sentence there is no space between $5000 and for. So $5000for is getting assigned to the TheContent variable instead of $5000.
I would like to assign only the number value to TheContent variable. Can you please help me for one more time.