Reputation: 2321
I'm writing a macro in Excel that is reading some text from a single cell.
ProductID = rw.Cells(1, 1).Text
However the cell may contain some buffer characters, specifically 5 consecutive space characters. I am trying to remove all the characters (length and actual text may vary) after the 5 spaces (including the spaces).
So if the string was:
MyProduct123 removethis
The desired string would be
MyProduct123
It seems I can remove the 5 spaces with
Replace(MyProductStr, " ", "")
but how can I get the position of the right side string or the text to remove that?
Upvotes: 0
Views: 438