Adjust CSV Output to Remove Xtra Commas

erock24

Well-known Member
Joined
Oct 26, 2006
Messages
1,163
I am creating CSV files via macro. Everything is working as it should. I was just curious if it is possible to edit the output to clean extra commas.

For example if i create a csv with 2 rows. The 1st row has 1 column used and the 2nd has 8 columns used. The 1st row will have 7 commas (as it should) that I currently have to manually remove via Ultraedit text editor. Is there a way to automate this removal from the creation of the csv file?

Any file i create will always only have 2 different length of data interms of columns used. What I mean is the file will always have rows with data in just 1 column and rows with data in more, but the more cols will always be the same. So the number of commas to remove would be = (Total Columns Used -1). In the previous example we would need to remove all instances of 7 comma groups or ",,,,,,"

I hope there's a solution.
Thanks,
 
Norie,

was wondering if you could take a minute to explain what your posted code is doing. It works great, but I don't understand a lick of it. Like what's the purpose of the free file?, etc.

Thank you.
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top