Macro to change saved name

  • Thread starter Thread starter roger
  • Start date Start date
R

roger

I have a couple thousand rows of data that I need to sort
by supervisor. However, it is payroll info, so I have to
sort, copy, and paste each supervisors info into a new
workbook without showing them the other info, each book
will then be e-mailed to the respective supervisors.

I can writew a macro to do everything except change the
save name. I tried copying and pasting into the save as
box, but it continues to save it under the original name I
used when writing the macro. Is there anything I can do?

Thanks
 
superName should hold the name of the supervisor.

sName = "C:\Folder1\" & superName & ".xls"
activeworkbook.SaveAs Filename:=sName
activeworkbook.Close SaveChanges:=False
 

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

Back
Top