Auto file naming with macro

M

Matt G

Hi,

I have a macro that rearranges the info in a file the way I want it. I
would to be able to save the updated file automatically using a static
beginning then adding a name part from within the worksheet. I don't want to
"SaveAs"; I want to overwrite the original file

For example: I want the file named "Account changes for 0XXX" where XXX
would be Left(C2, 3)

Any help is appreciated
 
R

ryguy7272

Can you get this to work?

Sub Macro1()
Dim SaveHere As Variant
SaveHere = Range("B2")
ActiveWorkbook.SaveAs Filename:= _
"C:\SaveHere.xls", FileFormat:=xlExcel8
End Sub


Regards,
Ryan---
 
J

Jacob Skaria

Hi Matt

Greetings. Please try the below code

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "c:\Account changes for 0" & Left(Range("C2"), 3)
Application.DisplayAlerts = True

Cheers!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top