Passer une variable à une procédure appelé par onaction
Bonjour,
Le titre n 'est certainement pas très claire mais je vais développer.
Je cherche à passer le nom d ' un objet shape lorsque celui ci est activé
(déclenchement de "l 'évenement" onaction)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
Sub mise_en_page()
Dim i As Byte
Dim j As Byte
Const Rwidth = 45
Const Rheigth = 43
For i = 1 To 6
For j = 1 To 7
Set Stabl(i, j) = ActiveSheet.Shapes.AddShape(msoShapeOval, Cells(i + 1, j + 3).Left + (Cells(i + 1, j + 3).Height - Rheigth) / 2, Cells(i + 1, j + 3).Top + (Cells(i + 1, j + 3).Width - Rwidth) / 2, Rwidth, Rheigth)
Stabl(i, j).Name = "t" & i & j
Stabl(i, j).OnAction = "'ref_col_ligne(j)'" 'ICI
Next j
Next i |
Pour passer par exemple la valeur 4 à la procédure "ref_col_ligne(n)"
Code:
1 2 3 4 5 6
|
Stabl(i, j).OnAction = "'ref_col_ligne(""4"")'"
Sub ref_col_ligne(n)
MsgBox n
End Sub |