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 44 45 46 47 48 49 50 51 52
| Option Explicit
Public currentwk As Workbook
Public currentws As Worksheet
Public currentws1 As Worksheet
Sub Modif_valeur_butée()
'
' Modif_valeur_butée Macro
Set currentwk = ActiveWorkbook
If currentwk Is Nothing Then Exit Sub
Set currentws = currentwk.Worksheets("Données des butées")
If currentws Is Nothing Then
MsgBox "la feuille Données des butées n'existe pas!, vbCritical"
Exit Sub
End If
Set currentws1 = currentwk.Worksheets("Gestion Data des Butée F1")
If currentws1 Is Nothing Then
MsgBox "la feuille Gestion Data des butées F1 n'existe pas!, vbCritical"
Exit Sub
End If
If currentws.Range("K3") = "1" Then
currentws.Range("A2:B22").Select
Selection.Copy
currentws1.Activate
currentws1.Range("C4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Else
If currentws.Range("K4") = "2" Then
currentws.Range("F2:G22").Select
Selection.Copy
currentws1.Activate
currentws1.Range("C4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Else
If currentws.Range("K5") = "3" Then
currentws.Range("K4:L22").Select
Selection.Copy
currentws1.Activate
currentws1.Range("C4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
End If
End If
End Sub |