Changing file name in cell based on another cells' values

aismail83

New Member
Joined
Mar 12, 2023
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I have around 400 workbooks are named "1.xlsx, 2.xlsx....400.xlsx" in same folder, because they have merged cells I can't do VLOOKUP, so I need to pick this data manually by
Excel Formula:
='C:\Users\Documents\2023\Data\RawData-Mar\[1.xlsx]Sheet1'!$C$4

so, I need to file name be changed to match serial number of that cell, example

S/N
AB
S/NCustomer name
1
Excel Formula:
='C:\Users\Documents\2023\Data\RawData-Mar\[=a1.xlsx]Sheet1'!$C$4
2
Excel Formula:
='C:\Users\Documents\2023\Data\RawData-Mar\[=a2.xlsx]Sheet1'!$C$4
3
Excel Formula:
='C:\Users\Documents\2023\Data\RawData-Mar\[=a3.xlsx]Sheet1'!$C$4
4
Excel Formula:
='C:\Users\Documents\2023\Data\RawData-Mar\[=a4.xlsx]Sheet1'!$C$4

the problem here that i have 8 more fields from each workbook, and when I tried this I have to manually confirm the file location for each field.

any ideas?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi,
You can test and adapt following
VBA Code:
Sub Rename()
' With Current File Name in cell A1  AND  New File Name in cell A2 :
 Name ActiveSheet.Range("A1") As ActiveSheet.Range("A2")
End Sub
 
Upvote 0
Hi,
You can test and adapt following
VBA Code:
Sub Rename()
' With Current File Name in cell A1  AND  New File Name in cell A2 :
 Name ActiveSheet.Range("A1") As ActiveSheet.Range("A2")
End Sub

thanks James,

any tutorial to implement this?
 
Upvote 0
Tutorial ???
Just make a Test ...
The comment shown in Green explains How to Use the Macro ....
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top