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
|
Dim nomFichier As String
Dim tmpStr, Rep
Columns(1).Find("*", , , , , xlPrevious).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.EntireRow.Insert
Range("fiche_originale").Copy
ActiveSheet.Paste
Rep = "C:\Users\user\desktop\" 'Chemin et répertoire à ouvrir
If Dir(Rep, vbDirectory) <> "" Then
ChDir Rep
Rep = Application.GetOpenFilename()
If Rep <> False Then
tmpStr = Split(Rep, "\")
nomFichier = tmpStr(UBound(tmpStr))
MsgBox nomFichier
Cells.Replace What:="original.01.xlsm", Replacement:=nomFichier, LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Else
MsgBox "Action annulée"
End If
Else
MsgBox "Chemin introuvable"
End If |
Partager