problème UserForm

Goldorak

XLDnaute Nouveau
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
 

Staple1600

XLDnaute Barbatruc
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 ;) )
 

Gelinotte

XLDnaute Accro
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
 

Gelinotte

XLDnaute Accro
Re : problème UserForm

Bonsoir,

Non, je n'ai pas utilisé son fichier, il semble corrompu, je ne peux pas l'ouvrir.

J'ai créé un bout de fichier pour valider le fonctionnement.


G
 

Pièces jointes

  • Classeur111.xlsm
    16.6 KB · Affichages: 27
  • Classeur111.xlsm
    16.6 KB · Affichages: 37
  • Classeur111.xlsm
    16.6 KB · Affichages: 30

Goldorak

XLDnaute Nouveau
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
 

Discussions similaires

Membres actuellement en ligne

Statistiques des forums

Discussions
313 344
Messages
2 097 337
Membres
106 916
dernier inscrit
Soltani mohamed