VBA to export a table to CSV/TXT

BakerUK

New Member
Joined
Nov 19, 2015
Messages
28
Hi guys

I'm after some VB to simply select a table within an Excel worksheet (not the full worksheet, just the table including it's headers) and output it as either a txt file or a csv.

I did an extensive Google search for this and found loads to try but can't quite get any of them to work - so would really appreciate any suggestions!

The closest I've come outputs to a txt file without any errors but the txt file mysteriously stops midway through row 606 out of 756. There are no unusual characters in the cell it stops at, the txt file size is 297 KB. So I don't know if I've hit some sort of a max limit somewhere?

Hope someone can help!

Thanks

Baker
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
This may sound a bit weird, but are you saving directly to a network or to a hosted network elsewhere?

When you export to a hosted network, if bandwidth is limited, it can take 10 mins or more for the full file to come through. I've had that in the past, would sit there scratching my head and then when I came back a while later the full file had appeared.
 
Upvote 0
Thanks for the response. It's direct to a network so it's not due to connectivity or network speed issues.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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