Hi Everyone!
I tried my best to do this on my own before asking I didnt want to be a pain. I am practicing and new to this. I will try to explain as best as possible of what I am trying to do.
**RENAME PROJECT**
So I wanted to do a macro using VBA to rename hundreds of PDF files in a folder with a specific number I have meaning for.
CURRENTLY NAMED----------WHAT I WOULD LIKE IT TO BE NAMED
Column A ------------ Column B
123 Elm st ------------ 105648
598745 ------------- 485214
pacific arc --------------- 419482
**Problems
I need to use wild card to find some of the column A files due to the files having more jibberish written than what I have listed.
(FOR EXAMPLE)
The file name that I have might be different than what it really is....
MY LIST-PACIFIC ARC
ACTUAL FILE NAME-441432pacificarc.pdf
The names in column A have a unique part of what the file is actually named but in different ways for instance column A might name a phone number that the file name has part of or an address or a name so I would need it to search for the file using column A complete name if not whole name.
(FOR EXAMPLE)
I would like it to search for different things and go over the files on the list 3 times. TO make sure it didnt miss anything. So I wanted to do like a wild card find *123 Elm St* to see if it would find it.
1st ------------- 2nd -----------3rd
Address -----Member Num----internal num
123 Elm St----123231312------3213213
All files in column A might not have a file for them so I dont want to see any errors come up. If possible even if it could generate a list of the ones not found.
This is what I have so far. Its hundreds of files. If I can explain anything better please let me know.
Sub ReName()
Dim rFiles As Range, rCell As Range
Dim strNewName As String, strOld As String
Dim strPath As String
Dim wbOpen As Workbook
Application.ScreenUpdating = False
Set rFiles = Range("A1", Range("A65536").End(xlUp))
strPath = "C:\Users\ file path\"
For Each rCell In rFiles
On Error Resume Next
strOld = strPath & rCell(1, 1)
Old = strPath & rCell
strNewName = strPath & rCell(1, 2)
Name strOld As strNewName
Next rCell
Application.ScreenUpdating = True
End Sub
Bookmarks