Rename File from list

  • Thread starter Thread starter Cesar Zapata
  • Start date Start date
C

Cesar Zapata

Hello,

I'm trying to make a kind like batch renamer in excel any ideas will be
appreaciated.

What i'm trying to do is to rename the "Active Workbook" with the
current name + value of a cell from a list.

for example lets say in cell A1 to a5 I have

NY
CT
MI
NV
TX

so I need to create 5 workbooks ... like

Sales NY.xls
Sales CT.xls
Sales MI.xls
Sales NV.xls
Sales TX.xls

the macro will be part of an addin. Thanks


TIA

CZ
 
Try something like the following....

' somewhere to build the file name string
Dim MyFileName As String
MyFileName = "C:\" & Trim(Range("A1").Value) & ".xls"


ActiveWorkbook.SaveAs Filename:=MyFileName, FileFormat:=xlNormal

Cheers
Nigel
 

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