Erreur variable objet

Bonjour,

J'utilise une macro qui fonctionne à l'ouverture d'un fichier et où je peux ensuite modifier la date via une toupie.

Cette macro fonctionne parfaitement à l'ouverture mais dès que je change de date, une erreur "Variable objet ou variable de bloc With non définie" pourtant j'utilise le même code.

je vous joins le code:

Private Sub SpinButton1_Change()

Label2 = Range("D3").Value + SpinButton1.Value

Dim col As Integer

Dim monTxt As String

Dim com As String

For Each cell In ActiveSheet.Range("F3:NF3")

If cell.Value = Label2.Caption Then

cell.Select

col = ActiveCell.Column

End If

Next

For i = 4 To Range("E65536").End(xlUp).Row

If Cells(i, col) <> "" Then

If Cells(i, col).Comment.Text <> "" Then

com = Cells(i, col).Comment.Text

End If

monTxt = monTxt & Chr(10) & Chr(13) & Cells(i, 1) & " " & Cells(i, col) & " " & com

End If

Next i

UserForm1.TextBox1.Text = monTxt

End Sub

Merci de votre aide

J'ai trouvé quelques infos sur le forum, notamment qu'il est préférable d'utiliser :

If Cells(i, col).Comment.Text Is Nothing Then

Le problème est que j'ai cette fois ci l'erreur "Objet requis"

bonjour,

essaie ainsi

If Cells(i, col).Comment Is Nothing Then

Merci c'est bon avec cette formule

Rechercher des sujets similaires à "erreur variable objet"