Copy files from folder and rename in destination folder

B

burl_h

The code below allows the user to select a folder to rename files,
using the existing name in column a, to the new name in column b, it
works very well. But I need a further twist.

I'd like to copy the files to a new folder then rename them based on
the newname in column b. I like the option to select which folder
using the with application.filedialog like below. Any help would be
grealy appreciated.

Thanks
burl_h
Sub RenameTheFiles()

Dim strFolder As String
Dim Rng As Range

With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show = True Then 'User did not click Cancel
strFolder = .SelectedItems(1)
Else
MsgBox "User clicked Cancel"
Exit Sub
End If
End With

For Each Rng In Range("A3:A5")
Name Rng As Rng(1, 2)
Next Rng
End Sub
 

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

Top