Macro to Export Sheet as CSV

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,563
Office Version
  1. 2021
Platform
  1. Windows
I have code to export a sheet as a csv

I will import one file at a time and selectb the macto to export sheet as a csv


I would like the csv filename to be be the same as the text in A6 followed by .csv for e.,g. WLTI.csv

I will import one file at a time , select the macro to export sheet as a csv and then import the next week

Your assistance in amending my code is most appreciated

Code:
 Sub Export_Imported_Sheet_As_CSV()

Application.DisplayAlerts = False

Dim Sht As Worksheet

Set Sht = Worksheets("Statement")

Sht.Copy

ActiveWorkbook.SaveAs Filename:="C:\extract\BRTI.CSV", FileFormat _

:=xlCSV

ActiveWorkbook.Close



Application.DisplayAlerts = True

end Sub


 
Last edited:
Thanks Jimmypop


If you cannot get it right, not to Worry, as it works If I have the name I want to save file as on a cell in the activesheet as per your post #2
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Thanks Jimmypop


If you cannot get it right, not to Worry, as it works If I have the name I want to save file as on a cell in the activesheet as per your post #2

Thanks Jimmypop


If you cannot get it right, not to Worry, as it works If I have the name I want to save file as on a cell in the activesheet as per your post #2
Does the most recent one also not work?
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,928
Members
449,094
Latest member
teemeren

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