I have to run reports from excel files on a regular basis for a certain project. The data comes to me with comma seperated values in a column . I needed to find a way to remove the leading and trailing commas and spaces without removing the commas and spaces from the middle of the strings. I was able to write something in VBA that works, but I can't figure out why it works.
Sample data
sample |
what I need the data to look like (also what the function i wrote is actually giving me) |
,, asdf , lkjh , , |
asdf , lkjh |
, asdf, |
asdf |
, asdf , |
asdf |
, asdf , |
asdf |
Here is the function that I wrote
What I can't figure out is why it is catching multiple commas and a spaces at the beginning and end of the string without a DO Loop.
Bookmarks