Passer un textbox en paramètre d'une procédure
Bonjour,
Je souhaite créer une procédure permettant d'envoyer le texte des Textbox de mon Userform aux cellules Excel.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11
|
Sub check(a As Integer, b As Integer, li As Integer, col As Integer, Optional txt As TextBox)
k = 1
For i = a To b
If UserForm2.Controls("CheckBox" & i).Value = True Then
Cells(li, col).Offset(k - 1, 0).Value = UserForm2.Controls("CheckBox" & i).Caption
k = k + 1
End If
Next i
Cells(li, col).Offset(k - 1, 0).Value = txt.Text
End Sub |
Le problème concerne la ligne Cells(li, col).Offset(k - 1, 0).Value = txt.Text
J'obtiens l'erreur 91: Variable objet ou variable de bloc With non définie.
Quelqu'un pourrait m'aider s'il vous plaît?
Merci.