Public WithEvents ButtonGroup As CommandButton
Private Sub ButtonGroup_Click()
Feuil2.Cells(Rows.Count, 1).End(3)(2) = ButtonGroup.Name & "|" & Date & "-" & Time
End Sub
Dim Buttons() As New Classe1
Sub Initier_Classe()
Dim Sh As Worksheet, Obj As OLEObject, ButtonCount As Integer
Set Sh = Sheets(1)
Erase Buttons
For Each Obj In Sh.OLEObjects
If TypeName(Obj.Object) = "CommandButton" Then
ButtonCount = ButtonCount + 1
ReDim Preserve Buttons(1 To ButtonCount)
Set Buttons(ButtonCount) = New Classe1
Set Buttons(ButtonCount).ButtonGroup = Obj.Object
End If
Next Obj
End Sub
Sub Enregistre()
With Sheets("Feuil2")
L = 1 + .Range("A65500").End(xlUp).Row
.Cells(L, 1) = Application.Caller
.Cells(L, 2) = Sheets("Feuil1").Shapes(Application.Caller).TextFrame2.TextRange.Text
.Cells(L, 3) = Now
End With
End Sub
Private Sub Workbook_Open()
For Each S In ActiveSheet.Shapes
S.Select
Selection.OnAction = "EnregistreInfo"
Next
End Sub
Sub Enregistre_A_ma_sauce()
With Application
Feuil2.Cells(Rows.Count, 1).End(3)(2).Resize(, 3) = Array(.Caller, Sheets("Feuil1").Shapes(.Caller).TextFrame2.TextRange.Text, Now)
End With
End Sub
Private Sub Workbook_Open()
Call Initier_Classe
End Sub
Pour un fichier perso, d'accord.Sans cochoncetés: juste des datas, pas de fioritures