Hi Dear All,
Iam new user of VBA. I need some help. I have hundreds of excel files in one folder. What I want to do is, to rename all of them by there cell values of A5 & A10 & A3 of sheet2*
*(different files have different names of sheet2)
for example if one file of excel cell's contains these informations....
sheet2 (name is hotel)
A5 (EUROPEAN VVIP Rates)
A10 (All rates below are USD non commissionable)
A3 (Updated as on 06/12/2009)
then that excel file should be renamed as
"EUROPEAN VVIP Rates USD Updated as on 06/12/2009"
Note: in A10 i only need currency type which could be any.
I need VBA which renames all files at onces
thanks in advance.
You'll find code to extract all the file names in a folder on my home page. To rename, you need to use the Name ...... As .... construct.
Remember that there are some characters which are not allowed in file names so you will need to think about the format of the date that you wish to use to avoid slashes.
Martin
Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.
If my solution has saved you time and/or money, please consider donating to Cancer Research UK.
Hi,
As indicated above, the VBA instruction is
HTHName OldName As NewName
Assuming that you have old and new file names in columns 1 & 2 respectively
Code:Sub Test() For N = 1 To Cells(Rows.Count, 1).End(xlUp).Row Name Cells(N, 1) As Cells(N, 2) Next N End Sub
Martin
Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.
If my solution has saved you time and/or money, please consider donating to Cancer Research UK.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks