Save As Macro - Newbie question

Victoir

New Member
Joined
Feb 10, 2005
Messages
5
Hi

My experience is limited to recording the occasional macro, but I need to create a Macro that saves loads of worksheets as CSV files. I've a list of the worksheets to select, and a concatenated list of the path and filenames I'd like them saved as on the worksheet 'Control'.

I've really tried with the search function, but, as I said, I've got zero experience with this sort of thing. Please take pity on me!

Thanks.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I can obviously give more details if they're needed.

If I don't find out how to do this then I'll have to manually 'save as' over 1000 sheets in the next couple of weeks.

That would be bad. ;(
 
Upvote 0
I've tried the code below. There's obviously something wrong with the way I'm trying to use the variables in the activate and save statements, but I can't find what.

Sub Macro2()
Dim strFileName As String
Dim Wsheet As String
strFileName = Worksheets("Key").Range("D18")
Wsheet = Worksheets("Key").Range("A18").Text
Worksheets(Wsheet).Activate
ActiveWorkbook.SaveAs Filename:= _
strFileName _
, FileFormat:=xlCSV, CreateBackup:=False
End Sub

Obviously, even if I get this working, I'll need to enhance it to loop over a values in a range of cells.
 
Upvote 0

Forum statistics

Threads
1,206,753
Messages
6,074,738
Members
446,082
Latest member
fgiron83

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