VBA Excel Loop sur Range de Cells - Copie Ficher
Bonjour à tous,
Je suis novice en VBA pour Excel. Je cherche à faire une copie de fichier sur base d'un range de cellules. J'y suis arrivé sur une cellule mais je bloque sur la boucle
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| Sub SaveasJob12()
' By Norie modified - This one Worked
Dim MyFile As String
Dim MyDir As String
Dim MyName As String
Dim sDir As String
MyDir = Sheets("sheet1").Range("B1").Text
MyFile = Sheets("sheet1").Range("C1").Text
MyName = Sheets("sheet1").Range("E1").Text
sDir = MyDir & "\" & MyFile & "-" & MyName
MsgBox sDir
If FileFolderExists(sDir) Then
MsgBox "Folder exists!"
Else
MsgBox "Folder does not exist!"
MkDir sDir
ChDir sDir
End If
'ActiveWindow.Close
Dim MyDir1 As String
Dim sDir1 As String
MyDir1 = Sheets("sheet1").Range("a15").Text
sDir1 = MyDir1
MsgBox sDir1
If FileFolderExists(sDir1) Then
MsgBox "Folder exists!"
Else
MsgBox "Folder does not exist!"
MkDir sDir1
ChDir sDir
End If
End Sub |
:cry: