jerry24
Nouveau membre
salut j'ai un petit pb sur un projet excel. lorsque je compile ca me di ke j'ai un bloc If sans End If ... j'ai beau regarder ms je trouve pas, ca me rend fou aidez moi si vs le pouvez merci bcp )
voici le code de la fonction :
Private Sub ajouter_Click()
If marque.alfaRomeo = False And marque.audi = False And marque.bmw = False And marque.citroen = False And marque.ford = False And marque.jaguar = False And marque.lexus = False And marque.mercedes = False And marque.opel = False And marque.peugeot = False And marque.renault = False And marque.toyota = False And marque.volkswagen = False Then
GoTo Erreur
If garantie.garantieOui = False And garantie.garantieNon = False Then GoTo Erreur
If prixbox = 0 Or garantiebox = 0 Then GoTo Erreur
If civilite.monsieur = False And civilite.madame = False And civilite.mademoiselle = False Then GoTo Erreur
If nombox = "" Or prenombox = "" Or adressebox = "" Or cpbox = "" Or villebox = "" Or telbox = "" Then
GoTo Erreur
'definition de la marque
If marque.alfaRomeo Then
Choix = "AlfaRomeo"
ElseIf marque.audi Then
Choix = "Audi"
ElseIf marque.bmw Then
Choix = "BMW"
ElseIf marque.citroen Then
Choix = "Citroen"
ElseIf marque.ford Then
Choix = "Ford"
ElseIf marque.jaguar Then
Choix = "Jaguar"
ElseIf marque.lexus Then
Choix = "Lexus"
ElseIf marque.mercedes Then
Choix = "Mercedes"
ElseIf marque.opel Then
Choix = "Opel"
ElseIf marque.peugeot Then
Choix = "Peugeot"
ElseIf marque.renault Then
Choix = "Renault"
ElseIf marque.toyota Then
Choix = "Toyota"
Else
Choix = "Volkswagen"
End If
If garantiePlus.garantieOui Then
Gar = "Oui"
Else
Gar = "Non"
End If
If civilite.monsieur Then
Civ = "Monsieur"
ElseIf civilite.madame Then
Civ = "Madame"
Else
Civ = "Mademoiselle"
End If
Sheets("SAV").Select
If Range("a2").Value = "" Then
decalage = 0
Range("a2").Select
Else
decalage = 1
Position = Range("A1").End(xlDown).Address
Range(Position).Select
Range("A1").End(xlDown).Select
End If
ActiveCell.Offset(decalage, 0).Range("a1").Select
ActiveCell.Value = Choix
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = MODELE
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = Gar
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = CCur(cout.Value)
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = prixbox
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = garantiebox
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = CCur(cout + garantiebox)
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = Civ
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = UCase(nombox)
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = prenombox
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = adressebox
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = cpbox
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = UCase(villebox)
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = telbox
Sheets("voitures").Select
GoTo fin
Erreur:
Message = MsgBox("Veuillez saisir tous les champs SVP, merci ", vbOKOnly + vbCritical, "Jerem'Concessionnaire")
fin:
End Sub
merci bcp bcp par avance
bonne soiree
jeremy
voici le code de la fonction :
Private Sub ajouter_Click()
If marque.alfaRomeo = False And marque.audi = False And marque.bmw = False And marque.citroen = False And marque.ford = False And marque.jaguar = False And marque.lexus = False And marque.mercedes = False And marque.opel = False And marque.peugeot = False And marque.renault = False And marque.toyota = False And marque.volkswagen = False Then
GoTo Erreur
If garantie.garantieOui = False And garantie.garantieNon = False Then GoTo Erreur
If prixbox = 0 Or garantiebox = 0 Then GoTo Erreur
If civilite.monsieur = False And civilite.madame = False And civilite.mademoiselle = False Then GoTo Erreur
If nombox = "" Or prenombox = "" Or adressebox = "" Or cpbox = "" Or villebox = "" Or telbox = "" Then
GoTo Erreur
'definition de la marque
If marque.alfaRomeo Then
Choix = "AlfaRomeo"
ElseIf marque.audi Then
Choix = "Audi"
ElseIf marque.bmw Then
Choix = "BMW"
ElseIf marque.citroen Then
Choix = "Citroen"
ElseIf marque.ford Then
Choix = "Ford"
ElseIf marque.jaguar Then
Choix = "Jaguar"
ElseIf marque.lexus Then
Choix = "Lexus"
ElseIf marque.mercedes Then
Choix = "Mercedes"
ElseIf marque.opel Then
Choix = "Opel"
ElseIf marque.peugeot Then
Choix = "Peugeot"
ElseIf marque.renault Then
Choix = "Renault"
ElseIf marque.toyota Then
Choix = "Toyota"
Else
Choix = "Volkswagen"
End If
If garantiePlus.garantieOui Then
Gar = "Oui"
Else
Gar = "Non"
End If
If civilite.monsieur Then
Civ = "Monsieur"
ElseIf civilite.madame Then
Civ = "Madame"
Else
Civ = "Mademoiselle"
End If
Sheets("SAV").Select
If Range("a2").Value = "" Then
decalage = 0
Range("a2").Select
Else
decalage = 1
Position = Range("A1").End(xlDown).Address
Range(Position).Select
Range("A1").End(xlDown).Select
End If
ActiveCell.Offset(decalage, 0).Range("a1").Select
ActiveCell.Value = Choix
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = MODELE
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = Gar
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = CCur(cout.Value)
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = prixbox
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = garantiebox
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = CCur(cout + garantiebox)
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = Civ
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = UCase(nombox)
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = prenombox
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = adressebox
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = cpbox
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = UCase(villebox)
ActiveCell.Offset(0, 1).Range("a1").Select
ActiveCell.Value = telbox
Sheets("voitures").Select
GoTo fin
Erreur:
Message = MsgBox("Veuillez saisir tous les champs SVP, merci ", vbOKOnly + vbCritical, "Jerem'Concessionnaire")
fin:
End Sub
merci bcp bcp par avance
bonne soiree
jeremy