Re : appel macro
re
voici
j'ai cela dans mon userform5
Private Sub CommandButton1_Click()
Dim xlig As Long
Workbooks("base peche.xls").Activate
Sheets("CIBLES").Activate
ActiveSheet.Protect DrawingObjects:=False, Contents:=False, Scenarios:=False
xlig = Range("a65536").End(xlUp).Row + 1
Dim c As Worksheet 'déclare la variable C (Cible)
Dim CRang As Range 'déclare la variable CRang
Dim CelC As Range 'déclare les variable CelC
Dim x, a As Long 'déclare la variable x
Set c = Sheets("CIBLES") 'définit la variable O
Set CRang = c.Range("A2:A" & c.Range("A65536").End(xlUp).Row) 'définit la variable CRang
x = 0 'définit la variable x
For Each CelC In CRang 'boucle sur toutes les cellule de la plage ORang
If CelC = Label2 Then 'condition : si la cellule n'est pas vide
a = CelC.Row
Cells(a, 1) = Label2
Cells(a, 2) = Label4
Cells(a, 3) = Label7
Cells(a, 4) = Label10
Cells(a, 5) = Label22
Cells(a, 6) = Label21
Cells(a, 7) = Label31
Cells(a, 8) = Label29
Cells(a, 9) = TextBox4.Value
Cells(a, 10) = Label35
Cells(a, 11) = TextBox6.Value
Cells(a, 12) = Label33
Cells(a, 13) = Label37
Cells(a, 14) = Date
TextBox3 = ""
TextBox2 = ""
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("base peche").Activate
UserForm5.Hide
Unload Me
Exit Sub
Exit For
End If
Next CelC
For Each CelC In CRang 'boucle sur toutes les cellule de la plage ORang
If CelC <> Label2 Then 'condition : si la cellule est vide
Cells(xlig, 1) = Label2
Cells(xlig, 2) = Label4
Cells(xlig, 3) = Label7
Cells(xlig, 4) = Label10
Cells(xlig, 5) = Label22
Cells(xlig, 6) = Label21
Cells(xlig, 7) = Label31
Cells(xlig, 8) = Label29
Cells(xlig, 9) = TextBox4.Value
Cells(xlig, 10) = Label35
Cells(xlig, 11) = TextBox6.Value
Cells(xlig, 12) = Label33
Cells(xlig, 13) = Label37
Cells(xlig, 14) = Date
TextBox3 = ""
TextBox2 = ""
Exit For
End If
Next CelC 'prochaine cellule de la plage ORang
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("base peche").Activate
UserForm5.Hide
Unload Me
End Sub
et je voudrai l'activer à dans mon module7.
cdl damien