Hi All,
Below is a example of daily downloaded files(somedays are > 30) which I manually placed in a folder.
The downloaded files names are not useful (Screenshot). I have been "manually renaming" and saving using the below VBA. I do not need to make a copy of these files, just needs to rename them.Cell A2 usually have the correct name.
I would typically open and click on eack file to make it the Activeworkbook, then run the below code.
Was wondering if there is a way to loop through each file and rename them based on cell A2.
Sub FileNameAsCellContent()
Dim FileName As String
Dim Path As String
Application.DisplayAlerts = False
Path = "C:\Users\C-TL\Box\Amp_Page_Views\Data\"
FileName = Application.Trim(Range("A2").Value) & ".xlsx"
ActiveWorkbook.SaveAs Path & FileName, xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
Imran
Quote Reply
Report Edit
Below is a example of daily downloaded files(somedays are > 30) which I manually placed in a folder.
The downloaded files names are not useful (Screenshot). I have been "manually renaming" and saving using the below VBA. I do not need to make a copy of these files, just needs to rename them.Cell A2 usually have the correct name.
I would typically open and click on eack file to make it the Activeworkbook, then run the below code.
Was wondering if there is a way to loop through each file and rename them based on cell A2.
Sub FileNameAsCellContent()
Dim FileName As String
Dim Path As String
Application.DisplayAlerts = False
Path = "C:\Users\C-TL\Box\Amp_Page_Views\Data\"
FileName = Application.Trim(Range("A2").Value) & ".xlsx"
ActiveWorkbook.SaveAs Path & FileName, xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
Imran
Quote Reply
Report Edit