Export all data ion sheet BR1

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,509
Office Version
  1. 2021
Platform
  1. Windows
I have a sheet called BR1. I would like a macro to export this sheet as a CSV file "Called BR1 Div.csv" and must be saved to a directory called dividends


Your assistance in this regard is most appreciated
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
This is actually pretty easy to do yourself.

Just turn on the Macro Recorder, and record yourself going to that sheet and saving as a CSV file to the directory and name that you like. Then stop the Macro Recorder. You will then have the code that you need to do this.
 
Upvote 0
Hi,

Try the below code.


After ABC to Desktop please change your domain and folder name.
Sub saveascsv()
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\ABC\Desktop\BR1 Div.csv", FileFormat:=xlCSV, CreateBackup:=False
End Sub


Thanks,
SK
 
Upvote 0
Hi Joe

Thanks for the reply. I have several sheets. I only want to export the sheet BR1
 
Upvote 0
By default, when you do a SaveAs to any text file format (like CSV), it only lets you do one page!
So even if you have 100 pages in your workbook, if you do the steps I told you, you will only be exporting the page that you are on when you run it.
 
Upvote 0
Hi Joe

Thanks for the help. I have tried recording the code and it works
 
Upvote 0
Hi Joe

Thanks for the help. I have tried recording the code and it works
 
Upvote 0
Thanks for the help. I have tried recording the code and it works
Great! And you learned a little programming trick to boot!

Even for tasks that are more complicated, you can start a lot of VBA code by using the Macro Recorder by getting some base code, and building on to it.
 
Upvote 0

Forum statistics

Threads
1,203,462
Messages
6,055,563
Members
444,799
Latest member
CraigCrowhurst

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