Erreur de compilation VBA

Bonjour

J'ai récupérer ce fichier gestion de stock et j'ai modifier quelque ligne pour mon besoin , et chaque fois que je pense avoir fini , il me met une erreur de compilation attendu = Variable.

Pouvez vous me dire, sur quel ligne j'ai fais la faute .

Je joint le fichier , car je dois le rendre bientôt .

Merci d'avance

Cordialement

Public i, j, Ligne, Code, Nom_Prod, Tva, Qte, RefFrn, As Integer

Public PUA As Double

Private Sub UserForm_Initialize()

With SpinButton1

.Min = 0 'Valeur mini

.Max = 100000 'Valeur maxi

End With

'Pour afficher la dernière saisie

i = 2

While Feuil1.Cells(i, 1) <> ""

i = i + 1

Wend

i = i - 1

SpinButton1.Value = i

Frame2.Visible = False

Frame3.Visible = False

End Sub

Private Sub SpinButton1_Change()

i = SpinButton1.Value

'Empêche de trop remonter

If i < 2 Then

i = 2

SpinButton1.Value = i

End If

'récup les infos

If i > 1 Then

Ligne = Feuil1.Cells(i, 1)

TextBox_Code = Feuil1.Cells(i, 2)

TextBox_Nom_prod = Feuil1.Cells(i, 3)

TextBox_Desc = Feuil1.Cells(i, 4)

TextBox_Cat = Feuil1.Cells(i, 5)

TextBox_Tva = Feuil1.Cells(i, 6)

TextBox_Qté = Feuil1.Cells(i, 7)

TextBox_PUA = Feuil1.Cells(i, 8)

TextBox_RefFrn = Feuil1.Cells(i, 9)

TextBox_PUV = Feuil1.Cells(i, 10)

End If

'Vide si pas de produit

If Ligne = 0 Then

TextBox_Code = ""

TextBox_Nom_prod = ""

TextBox_Desc = ""

TextBox_Cat = ""

TextBox_Tva = ""

TextBox_Qté = ""

TextBox_PUA = ""

TextBox_Nom_Frn = ""

TextBox_PUV = ""

TextBox_Qté.BackColor.Bold = False

TextBox_Qté.BackColor = &H8000000F

Exit Sub

End If

'Affiche si stock égale zéro

If TextBox_Qté = 0 Then

TextBox_Qté.Font.Bold = True

TextBox_Qté.BackColor = vbRed

Else

TextBox_Qté.Font.Bold = False

TextBox_Qté.BackColor = &H8000000F

End If

'Affiche le nom du fournisseur

j = 2

While Feuil6.Cells(j, 1) <> ""

If Feuil6.Cells(j, 1) = Ligne Then

TextBox_Nom_Frn = Feuil6.Cells(j, 2)

End If

j = j + 1

Wend

Button_Valider.Visible = False

Button_Créer.Visible = True

End Sub

Private Sub TextBox_Nom_frn_Change()

'Affiche le nom du fournisseur

j = 2

While Feuil6.Cells(j, 3) <> ""

If Feuil6.Cells(j, 2) = TextBox_Nom_Frn Then

Ligne = Feuil6.Cells(j, 1)

TextBox_Ligne = Ligne

Exit Sub

End If

j = j + 1

Wend

End Sub

Private Sub CheckBox_Frn_Click()

If CheckBox_Frn = True Then

Frame3.Visible = True

Else

Frame3.Visible = False

End If

End Sub

Private Sub CheckBox_Réappro_Click()

If CheckBox_Réappro = True Then

Frame2.Visible = True

Else

Frame2.Visible = False

End If

End Sub

Private Sub Button_Créer_Click()

i = 2

While Feuil1.Cells(i, 1) <> ""

i = i + 1

Wend

SpinButton1.Value = i

Button_Créer.Visible = False

Button_Valider.Visible = True

End Sub

Private Sub Button_Valider_Click()

'Enregistre les info

If TextBox_Code <> "" Then

If Feuil1.Cells(2, 1) = "" Then

RefProd = 1

Else

Ligne = Feuil1.Cells(i - 1, 1) + 1

End If

Feuil1.Cells(i, 1) = Ligne

Feuil1.Cells(i, 2) = TextBox_Code

Feuil1.Cells(i, 3) = TextBox_Nom_prod

Feuil1.Cells(i, 4) = TextBox_Desc

Feuil1.Cells(i, 5) = TextBox_Cat

Dim Tva As Integer

If TextBox_Tva <> "" Then

Tva = TextBox_Tva

End If

Feuil1.Cells(i, 6) = TextBox_Tva

Feuil1.Cells(i, 7) = TextBox_Qte

Feuil1.Cells(i, 8) = TextBox_PUA

If TextBox_RefFrn <> "" Then

Frn = TextBox_Frn

End If

Feuil1.Cells(i, 9) = RefFrn

Dim PUV As Double

If TextBox_PUV <> "" Then

PUV = TextBox_PUV

End If

Feuil1.Cells(i, 10) = PUV

End If

Button_Valider.Visible = False

Button_Créer.Visible = True

End Sub

Private Sub Button_Suppr_Click()

If RefProd <> 0 Then

Dim Msg, Style, Ctxt, Response

Msg = "Voulez vous vraiment supprimer ce produit?"

Style = vbYesNo + vbCritical + vbDefaultButton2

Response = MsgBox(Msg, Style)

If Response = vbYes Then

Feuil1.Rows(i).Delete

i = i - 1

SpinButton1.Value = i

Else

Exit Sub

End If

End If

End Sub

Private Sub Button_Rechercher_Click()

i = 2

While Feuil1.Cells(i, 1) <> ""

If TextBox_Code <> "" And TextBox_Tva <> "" Then

Dim Tva As Integer

If TextBox_Tva <> "" Then

Tva = TextBox_Tva

End If

If Feuil1.Cells(i, 2) = TextBox_Code And Feuil1.Cells(i, 6) = Tva Then

SpinButton1.Value = i

Exit Sub

End If

End If

i = i + 1

Wend

Button_Valider.Visible = False

Button_Créer.Visible = True

End Sub

Private Sub Button_Modifier_Click()

If RefProd <> 0 Then

Dim Msg, Style, Ctxt, Response

Msg = "Voulez vous vraiment modifier ce produit?"

Style = vbYesNo + vbCritical + vbDefaultButton2

Response = MsgBox(Msg, Style)

If Response = vbYes Then

Feuil1.Cells(i, 2) = TextBox_Code

Feuil1.Cells(i, 3) = TextBox_Nom_prod

Feuil1.Cells(i, 4) = TextBox_Desc

Feuil1.Cells(i, 5) = TextBox_Cat

Dim Qte As Integer

If TextBox_Qte <> "" Then

Qte = TextBox_Qte

End If

Feuil1.Cells(i, 6) = Tva

Qté = TextBox_Qté

Feuil1.Cells(i, 7) = Qté

Feuil1.Cells(i, 8) = TextBox_PUA

Feuil1.Cells(i, 9) = RefFrn

PUV = TextBox_Lot

Feuil1.Cells(i, 10) = PUV

If TextBox_PUV <> "" Then

PUV = TextBox_PUV

End If

Exit Sub

End If

End If

Button_Valider.Visible = False

Button_Créer.Visible = True

End Sub

Private Sub Button_Quitter_Click()

Button_Créer.Visible = True

Button_Valider.Visible = False

UserForm2.Hide

' UserForm1.Show

End Sub

Bonsoir,

Je n'ai vérifié que la compilation et mis en souligné ce que tu dois ajouter :

Supprime la virgule de la ligne :

Public i, j, Ligne, Code, Nom_Prod, Tva, Qte, RefFrn, As Integer

Mets un point après Feuill1 :

TextBox_Unité = Feuil1.cells(i, 3)

TextBox_Desci = Feuil1.cells(i, 4)

TextBox_Cat = Feuil1cells(i, 5)

Supprime les espaces de Ligne :

If l igne = "" Then

Enfin, supprime l'espace avant PUA :

TextBox_ PUA = Feuil1.Cells(i, 8)

Je ne sais pas si c'est toi qui a fait ces modifications ou si tu as récupéréle programme tel quel, mais si c'est la seconde solution, évite cette application.

Bonsoir

Merci pour tes conseils , je vais corriger les erreurs ,

et oui je pense que je vais changer d'applications ,

car j'ai passer trop de temps .

Merci

Cordialement

Je n'ai pas téléchargé le classeur, mais va voir sur ce site du coté des téléchargements (Outils de gestion divers), il y a une gestion de stocks.

Bon courage.

Bonjour

Merci pour ton info , et j'ai trouver , encore merci pour ton aide aussi rapide

Bonne journée

Cordialement

Rechercher des sujets similaires à "erreur compilation vba"