Export to CSV with a Variable Amount of Columns

jabce85

New Member
Joined
Jun 17, 2010
Messages
11
I have been searching for quite a while now for an answer to this problem with no success. This forum seems like the best place to find an answer. I'm looking for a macro to take the following input and export it to a csv file to look like what I have listed.

INPUT-----

5 5 5 5 5 5 5
5 5 5 5
5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5
5 5 5

CSV OUTPUT-------

5,5,5,5,5,5,5,
5,5,5,5,
5,5,5,5,5,5,
5,5,5,5,5,5,5,5,5,5,
5,5,5,

If at all possible, I need it to be able to keep the formating that is in the excel file when it exports to the CSV file as well.
 
So some of the cells in question have formulas? What would you expect to see in the csv in this instance?

I've tried incorporating formulas that produce results and those that don't and so far I'm achieving the results I'd expect.

Not sure how I can take this any further on what you're telling me.
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Sorry for the delay.. I had to modify it slightly to get it to work with all the other code I had; I wasn't just exporting to csv; the comma problem was my only stumbling block. Thanks once again!
 
Upvote 0

Forum statistics

Threads
1,215,453
Messages
6,124,930
Members
449,195
Latest member
Stevenciu

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