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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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