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
| Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim Ref As String, Fichier As String
Application.ScreenUpdating = False
If Target.Row > 1 And Range("A" & Target.Row) <> "" Then
Cancel = True
Range("CHOIX") = Target.Row - 1
Ref = Range("B" & Target.Row)
Fichier = ThisWorkbook.Path & "\FICHE DE " & Ref & ".xls"
Worksheets("Fiche MES").Copy
With ActiveWorkbook
With .Worksheets(1).UsedRange
.Value = .Value
End With
On Error Resume Next
Application.DisplayAlerts = False
.SaveAs Fichier
.Close
Application.DisplayAlerts = True
On Error GoTo 0
End With
MsgBox "Fichier de la référence [" & Ref & "] sauvegardé avec succès"
End If
End Sub |
Partager