-
Deleting words in a string
Hi Guys
I have 2 sets of security IDs. One includes a Bloomberg 'yellow key' and one does not.
so for example
ERZ9 vs ERZ9 Comdty
or Z Z9 Index
I am trying to think of a way of taking the yellow key (Comdty, Index, Crncy) out of the data.
essentially i want to locate the last space in the string and delete right of that space.
Any ideas?
sorry guys not sure on this one
thanks in advance for the help
JZB
-
[VBA]Sub TrimLast()
Dim Cel
For Each Cel In Selection
Cel.Value = Left(Cel, InStrRev(Cel, " ") - 1)
Next
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
that works a treat. thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules