Vba excel commentaire
vautour88
-
Arpakind -
Arpakind -
Bonjour,
J'ai un probleme avec cette macro, elle est censee decremente le commentaire de 1. Mais il y a une erreur de definition d application ou de definition d objet. Voici la ligne qui pose probleme :
Worksheets("stock").Range("A", u).Comment.Text Text:=Val(Worksheets("stock").Range("A", u).Comment.Text) - 1
Voici le code complet:
Private Sub CmdAdd_Click()
Dim test As String
If ComboBoxHostname.Text <> "" And TextBoxComment.Text <> "" And ComboBoxStatut.Text <> "" Then
a = 2
Do While Cells(1, a).Value <> ComboBoxHostname.Text
a = a + 1
Loop
i = 8
Do While Cells(i, a).Value <> ""
i = i + 1
Loop
Worksheets("INV").Cells(i, a).Value = LblDate.Caption
t = 6
Do While Cells(t, 1).Value <> ComboBoxStatut.Text
t = t + 1
Loop
Worksheets("INV").Cells(i, a).Interior.ColorIndex = Cells(t, 1).Interior.ColorIndex
Worksheets("INV").Cells(i, a).ClearComments
Worksheets("INV").Cells(i, a).Select
Worksheets("INV").Cells(i, a).AddComment
Worksheets("INV").Cells(i, a).Comment.Visible = False
Worksheets("INV").Cells(i, a).Comment.Text Text:=TextBoxComment.Text
If ComboBoxStatut.Text = "Consumables" And ComboBoxHostname.Text <> "" Then
u = 2
Do While Worksheets("stock").Cells(u, 1).Value <> ComboBoxConsu.Text
u = u + 1
Loop
Worksheets("stock").Range("A", u).Comment.Text Text:=Val(Worksheets("stock").Range("A", u).Comment.Text) - 1
End If
Unload UserForm1
End If
End Sub
J'ai un probleme avec cette macro, elle est censee decremente le commentaire de 1. Mais il y a une erreur de definition d application ou de definition d objet. Voici la ligne qui pose probleme :
Worksheets("stock").Range("A", u).Comment.Text Text:=Val(Worksheets("stock").Range("A", u).Comment.Text) - 1
Voici le code complet:
Private Sub CmdAdd_Click()
Dim test As String
If ComboBoxHostname.Text <> "" And TextBoxComment.Text <> "" And ComboBoxStatut.Text <> "" Then
a = 2
Do While Cells(1, a).Value <> ComboBoxHostname.Text
a = a + 1
Loop
i = 8
Do While Cells(i, a).Value <> ""
i = i + 1
Loop
Worksheets("INV").Cells(i, a).Value = LblDate.Caption
t = 6
Do While Cells(t, 1).Value <> ComboBoxStatut.Text
t = t + 1
Loop
Worksheets("INV").Cells(i, a).Interior.ColorIndex = Cells(t, 1).Interior.ColorIndex
Worksheets("INV").Cells(i, a).ClearComments
Worksheets("INV").Cells(i, a).Select
Worksheets("INV").Cells(i, a).AddComment
Worksheets("INV").Cells(i, a).Comment.Visible = False
Worksheets("INV").Cells(i, a).Comment.Text Text:=TextBoxComment.Text
If ComboBoxStatut.Text = "Consumables" And ComboBoxHostname.Text <> "" Then
u = 2
Do While Worksheets("stock").Cells(u, 1).Value <> ComboBoxConsu.Text
u = u + 1
Loop
Worksheets("stock").Range("A", u).Comment.Text Text:=Val(Worksheets("stock").Range("A", u).Comment.Text) - 1
End If
Unload UserForm1
End If
End Sub
A voir également:
- Vba excel commentaire
- Liste déroulante excel - Guide
- Word et excel gratuit - Guide
- Déplacer colonne excel - Guide
- Commentaire word - Guide
- Si ou excel - Guide
End If
Utilmiser & pour concatener
Patrick