Difficulté d'affichage sur une feuille excel programmation vba
donpepino225
Messages postés
3
Date d'inscription
Statut
Membre
Dernière intervention
-
Polux31 Messages postés 6917 Date d'inscription Statut Membre Dernière intervention -
Polux31 Messages postés 6917 Date d'inscription Statut Membre Dernière intervention -
bjr à tous voici tous les codes ke jè écris pour développer une application vba en Excel qui permettra de gérer les consommables. mais jè des problèmes pour pouvoir afficher après validation les saisies que je fais dans le Userform1 et en plus il me signale une erreur dans le code sur mon commandbouton que jè renommé VALIDER.
voici le codes en question. aidez moi à trouver une solution pour mon application car je dois la rendre le 20 février 2014. je compte sur vous. je vous signale que mon userform1 contient 6 combobox et 1 textbox en plus du bouton VALIDER.
Private Sub CommandButton1_Click()
Dim ctr As Control
Dim r As Integer
Dim t As Integer
Dim landry As Integer
With Worksheets("feuil1")
landry = .Range("A65536").End(x1up).Row + 2
landry = .Range("B65536").End(x1up).Row + 2
landry = .Range("C65536").End(x1up).Row + 2
landry = .Range("D65536").End(x1up).Row + 2
landry = .Range("E65536").End(x1up).Row + 2
landry = .Range("E65536").End(x1up).Row + 2
For Each ctr In UserForm1.Controls
r = Val(ctrl.Tag)
If r > 0 Then Feuil1.Cells(landry, r) = ctrl
Next
Feuil1.Cells(landry, 2) = Val(ComboBox1)
Feuil1.Cells(landry, 2) = Val(ComboBox2)
Feuil1.Cells(landry, 2) = Val(ComboBox3)
Feuil1.Cells(landry, 2) = Val(ComboBox4)
Feuil1.Cells(landry, 2) = Val(ComboBox5)
Feuil1.Cells(landry, 2) = Val(ComboBox6)
End With
ComboBox1 = ""
ComboBox2 = ""
ComboBox3 = ""
ComboBox4 = ""
ComboBox5 = ""
ComboBox6 = ""
End
End Sub
Private Sub UserForm_Activate()
If NOUVEAU = True Then ComboBox1 = WorksheetFunction.Max(Feuil1.Range("A2:A10000")) + 2
If NOUVEAU = True Then ComboBox2 = WorksheetFunction.Max(Feuil1.Range("B2:B10000")) + 2
If NOUVEAU = True Then ComboBox3 = WorksheetFunction.Max(Feuil1.Range("C2:C10000")) + 2
If NOUVEAU = True Then ComboBox4 = WorksheetFunction.Max(Feuil1.Range("D2:D10000")) + 2
If NOUVEAU = True Then ComboBox5 = WorksheetFunction.Max(Feuil1.Range("E2:E10000")) + 2
If NOUVEAU = True Then ComboBox6 = WorksheetFunction.Max(Feuil1.Range("F2:F10000")) + 2
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
'ComboBox1.AddItem "Masculin"
'ComboBox1.AddItem "Feminin"
Dim tablo, landry As Integer
With Feuil2
landry = .Range("A65536").End(xlUp).Row
tablo = .Range("A2:A" & landry)
ComboBox1.List = tablo
End With
With Feuil2
landry = .Range("B65536").End(xlUp).Row
tablo = .Range("B2:B" & landry)
ComboBox2.List = tablo
End With
With Feuil2
landry = .Range("C65536").End(xlUp).Row
tablo = .Range("C2:C" & landry)
ComboBox3.List = tablo
End With
With Feuil2
landry = .Range("D65536").End(xlUp).Row
tablo = .Range("D2:D" & landry)
ComboBox4.List = tablo
End With
With Feuil2
landry = .Range("E65536").End(xlUp).Row
tablo = .Range("E2:E" & landry)
ComboBox5.List = tablo
End With
With Feuil2
landry = .Range("F65536").End(xlUp).Row
tablo = .Range("F2:F" & landry)
ComboBox6.List = tablo
End With
End Sub
voici le codes en question. aidez moi à trouver une solution pour mon application car je dois la rendre le 20 février 2014. je compte sur vous. je vous signale que mon userform1 contient 6 combobox et 1 textbox en plus du bouton VALIDER.
Private Sub CommandButton1_Click()
Dim ctr As Control
Dim r As Integer
Dim t As Integer
Dim landry As Integer
With Worksheets("feuil1")
landry = .Range("A65536").End(x1up).Row + 2
landry = .Range("B65536").End(x1up).Row + 2
landry = .Range("C65536").End(x1up).Row + 2
landry = .Range("D65536").End(x1up).Row + 2
landry = .Range("E65536").End(x1up).Row + 2
landry = .Range("E65536").End(x1up).Row + 2
For Each ctr In UserForm1.Controls
r = Val(ctrl.Tag)
If r > 0 Then Feuil1.Cells(landry, r) = ctrl
Next
Feuil1.Cells(landry, 2) = Val(ComboBox1)
Feuil1.Cells(landry, 2) = Val(ComboBox2)
Feuil1.Cells(landry, 2) = Val(ComboBox3)
Feuil1.Cells(landry, 2) = Val(ComboBox4)
Feuil1.Cells(landry, 2) = Val(ComboBox5)
Feuil1.Cells(landry, 2) = Val(ComboBox6)
End With
ComboBox1 = ""
ComboBox2 = ""
ComboBox3 = ""
ComboBox4 = ""
ComboBox5 = ""
ComboBox6 = ""
End
End Sub
Private Sub UserForm_Activate()
If NOUVEAU = True Then ComboBox1 = WorksheetFunction.Max(Feuil1.Range("A2:A10000")) + 2
If NOUVEAU = True Then ComboBox2 = WorksheetFunction.Max(Feuil1.Range("B2:B10000")) + 2
If NOUVEAU = True Then ComboBox3 = WorksheetFunction.Max(Feuil1.Range("C2:C10000")) + 2
If NOUVEAU = True Then ComboBox4 = WorksheetFunction.Max(Feuil1.Range("D2:D10000")) + 2
If NOUVEAU = True Then ComboBox5 = WorksheetFunction.Max(Feuil1.Range("E2:E10000")) + 2
If NOUVEAU = True Then ComboBox6 = WorksheetFunction.Max(Feuil1.Range("F2:F10000")) + 2
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
'ComboBox1.AddItem "Masculin"
'ComboBox1.AddItem "Feminin"
Dim tablo, landry As Integer
With Feuil2
landry = .Range("A65536").End(xlUp).Row
tablo = .Range("A2:A" & landry)
ComboBox1.List = tablo
End With
With Feuil2
landry = .Range("B65536").End(xlUp).Row
tablo = .Range("B2:B" & landry)
ComboBox2.List = tablo
End With
With Feuil2
landry = .Range("C65536").End(xlUp).Row
tablo = .Range("C2:C" & landry)
ComboBox3.List = tablo
End With
With Feuil2
landry = .Range("D65536").End(xlUp).Row
tablo = .Range("D2:D" & landry)
ComboBox4.List = tablo
End With
With Feuil2
landry = .Range("E65536").End(xlUp).Row
tablo = .Range("E2:E" & landry)
ComboBox5.List = tablo
End With
With Feuil2
landry = .Range("F65536").End(xlUp).Row
tablo = .Range("F2:F" & landry)
ComboBox6.List = tablo
End With
End Sub
A voir également:
- Difficulté d'affichage sur une feuille excel programmation vba
- Liste déroulante excel - Guide
- Feuille de pointage excel - Télécharger - Tableur
- Déplacer une colonne excel - Guide
- Word et excel gratuit - Guide
- Comment trier par ordre alphabétique sur excel - Guide
5 réponses
Bonjour,
As-tu testé en mode débogage ? Ça te permettrait de voir ce que contient tes variables (comme par exemple landry !!!) et de voir tes erreurs de frappes comme x1Up au lieu de xlUp
As-tu testé en mode débogage ? Ça te permettrait de voir ce que contient tes variables (comme par exemple landry !!!) et de voir tes erreurs de frappes comme x1Up au lieu de xlUp
merci Polux31 car je n'avais pas remarquer mon erreur de frappe et je l'ai corrigé mais ça ne fonctionne toujours pas quand j'exécute il m'envoie un autre message d'erreur au niveau de:
For Each ctr In UserForm1.Controls
r = Val(ctrl.Tag)
il souligne en jaune r=Val(ctrl.tag)
qu'est ce que je dois faire?
For Each ctr In UserForm1.Controls
r = Val(ctrl.Tag)
il souligne en jaune r=Val(ctrl.tag)
qu'est ce que je dois faire?
Je ne comprends ce que tu veux faire avec la propriété Tag des contrôles ...
De plus Tag renvoie une chaîne de caractères et non un intéger !!!
De plus Tag renvoie une chaîne de caractères et non un intéger !!!
CONSOMMABLES TYPES SERIES DATE D'ARRIVEE QUANTITE
JOURS MOIS ANNEES
VOICI UN PEU les en-têtes du tableau excel dans lequel je souhaiterais afficher les données saisies dans le userform1.
CONSOMMABLES, TYPES, SERIES, DATE D'ARRIVEE ET QUANTITE SONT LES PRINCIPALES en-têtes.
JOURS MOIS ET ANNEES sont des sous en-têtes de DATE D'ARRIVEE.
ON part donc de la cellule A à la cellule G et l'affichage doit se faire à partir de la ligne 3 de chaque cellule.
JOURS MOIS ANNEES
VOICI UN PEU les en-têtes du tableau excel dans lequel je souhaiterais afficher les données saisies dans le userform1.
CONSOMMABLES, TYPES, SERIES, DATE D'ARRIVEE ET QUANTITE SONT LES PRINCIPALES en-têtes.
JOURS MOIS ET ANNEES sont des sous en-têtes de DATE D'ARRIVEE.
ON part donc de la cellule A à la cellule G et l'affichage doit se faire à partir de la ligne 3 de chaque cellule.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Ok ... mais tu attends quoi ?
On veut bien t'aider à trouver des solutions, mais en aucun cas à faire ton boulot.
On est là pour te donner des pistes ou des idées pour résoudre tes problèmes de codes.
Tu dis avoir un message d'erreur sur
il souligne en jaune r=Val(ctrl.tag)
Mais tu ne donnes pas le message d'erreur.
Relis bien tes 2 lignes de code ci dessus C'est quoi ctrl ?
On veut bien t'aider à trouver des solutions, mais en aucun cas à faire ton boulot.
On est là pour te donner des pistes ou des idées pour résoudre tes problèmes de codes.
Tu dis avoir un message d'erreur sur
For Each ctr In UserForm1.Controls r = Val(ctrl.Tag)
il souligne en jaune r=Val(ctrl.tag)
Mais tu ne donnes pas le message d'erreur.
Relis bien tes 2 lignes de code ci dessus C'est quoi ctrl ?