Can someone help me to modify existing code, allow me to copy multiple times of file based on quantity given in Colomn C.
- Sub CreateNewFolderAndCopyFiles()
- Dim Ret As Long
- '~~> This is where the images will be saved. Change as applicable
- Const ParentFolderName As String = "C:\Test\"
- 'extract file name from HyperLink
- 'rename file and place in destination folder
- Dim HypLink As Hyperlink
- Dim Folderpath As String
- Dim OrigFil As String, NewFil As String, x, r
- Folderpath = ParentFolderName & Range("C2").Value & "\"
- If Len(Dir(Folderpath, vbDirectory)) = 0 Then
- MkDir Folderpath
- End If
- DestFolder = Folderpath
- For Each HypLink In ActiveSheet.Hyperlinks
- x = InStrRev(HypLink.Address, "\")
- OrigFil = Mid(HypLink.Address, x + 1, 999)
- r = HypLink.Range.Row
- NewFil = Cells(r, 1).Value & "_" & OrigFil
- FileCopy HypLink.Address, DestFolder & NewFil
- End Sub