Split with consecutive delimiters
On Wed, 16 May 2007 02:21:02 -0700, simonc
wrote:
I am reading lines from a formatted data file (values in right justified
columns) and using split to extract the values from each line into an array.
The problem is the number of spaces between values is not constant, and split
adds a new array value for every space it finds in the text string. Is there
a way to set split to treat consecutive spaces as a single delimiter like you
can in TextToColumns?
No but you could remove the extraneous spaces by using
application.worksheetfunction.trim on the string. (Do NOT use the VBA Trim
function -- it only removes leading and trailing spaces).
--ron
|