• Initiateur de la discussion Initiateur de la discussion Goldorak
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

G

Goldorak

Guest
Bonjour à tous,
Je bloque depuis plusieurs jour sur ce code appartenant à un UseForm,
Je précise que je suis relativement débutant,
Merci vous

Option Explicit

Private Sub Contact_Change()
Contact.Value = UCase(Contact.Value)
End Sub
Private Sub Societe_Change()
Societe.Value = Application.WorksheetFunction.Proper(Societe.Value)
End Sub
Private Sub Rue_Change()
Rue.Text = Application.WorksheetFunction.Proper(RueText)
End Sub
Private Sub CPVille_Change()
CP.Value = Format(CP.Value, "00"" ""000")
End Sub
Private Sub Mail_AfterUpdate()
Mail = UCase(Mail)
End Sub
Private Sub Tel_AfterUpdate()
Tel.Value = Format(Tel.Value, "00"" ""00"" ""00"" ""00"" ""00")
End Sub

Private Sub CommandButton1_Click() ' VALIDER
Dim ligne As Integer
Sheets("CLIENTS").Select
ligne = Range("C200").End(xlUp).Row + 1
.Range("C" & ligne).Value = Contact.Value
.Range("D" & ligne).Value = Societe.Value
.Range("E" & ligne).Value = Rue.Value
.Range("F" & ligne).Value = CPVille.Value
.Range("G" & ligne).Value = Mail.Value
.Range("H" & ligne).Value = Tel.Value

Unload Me
Range("C10:H" & Range("C65536").End(xlUp).Row).Select
Selection.Sort Key1:=Range("C10"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=True, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Range("A1").Select
UserForm.Show

End Sub

Private Sub CommandButton2_Click()
Unload Me
Sheets("CLIENTS").Select
End Sub
 
Re : problème UserForm

Bonsoir à tous [edit=bonsoir calvus[/edit]

Oui plusieurs...

Zippes ton fichier Excel avant de le joindre

ou

Exportes ton projet VBA (puis zippes tous les fichiers obtenus en un seul *.zip, et joins ce zip)

ou pour finir:
Supprimes images, couleurs, formats
Ne gardes qu'une feuille + (code vba: module + userform)

(tu peux mixer ces 3 conseils pour alléger ton fichier 😉 )
 
Re : problème UserForm

Bonsoir

Ceci devrait fonctionner ...


Code:
Option Explicit
 
Private Sub Contact_Change()
Contact.Value = UCase(Contact.Value)
 End Sub
 Private Sub Societe_Change()
 Societe.Value = Application.WorksheetFunction.Proper(Societe.Value)
 End Sub
 Private Sub Rue_Change()
 Rue.Text = Application.WorksheetFunction.Proper(Rue.Value)
 End Sub
 Private Sub CPVille_Change()
 CPVille.Value = Format(CPVille.Value, "00"" ""000")
 End Sub
 Private Sub Mail_AfterUpdate()
 Mail = LCase(Mail)
 End Sub
 Private Sub Tel_AfterUpdate()
 Tel.Value = Format(Tel.Value, "00"" ""00"" ""00"" ""00"" ""00")
 End Sub
 
Private Sub CommandButton1_Click() ' VALIDER
 Dim ligne As Integer
Sheets("CLIENTS").Select
 ligne = Range("C200").End(xlUp).Row + 1
 Range("C" & ligne).Value = Contact.Value
 Range("D" & ligne).Value = Societe.Value
 Range("E" & ligne).Value = Rue.Value
 Range("F" & ligne).Value = CPVille.Value
 Range("G" & ligne).Value = Mail.Value
 Range("H" & ligne).Value = Tel.Value
 
Unload Me
 Range("C10:H" & Range("C65536").End(xlUp).Row).Select
 Selection.Sort Key1:=Range("C10"), Order1:=xlAscending, Header:=xlGuess, _
 OrderCustom:=1, MatchCase:=True, Orientation:=xlTopToBottom, _
 DataOption1:=xlSortNormal

 Range("A1").Select
 UserForm.Show
 
End Sub
 
Private Sub CommandButton2_Click()
 Unload Me
 Sheets("CLIENTS").Select
 End Sub


G
 
Re : problème UserForm

MILLE MERCI!!!!
Effectivement je n'avais pas nommer les TexBox partout, j'avais rajouter des "." devant Range et pour finir mon " UserForm.Show " à la fin devait être " NOUVEAU_CLIENT.Show
Visiblement ma route s'annonce longue sur mon projet!
Mille merci pour votre perspicacité et votre rapidité à tous,
Alex
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD
Assurez vous de marquer un message comme solution pour une meilleure transparence.

Discussions similaires

Réponses
9
Affichages
385
Réponses
5
Affichages
910
Réponses
2
Affichages
589
Retour