'Ecriture des éléments de la fenètre inscription dans la feuille excel
Private Sub Inscrire_Click()
Dim Nbligne As Long
Dim BonneLigne As Long
Dim i As Integer
Worksheets("Adherent").Activate
Nbligne = Range("A1").End(xlDown).Row
BonneLigne = Nbligne + 1
If leNom.Text = "" Or lePrenom.Text = "" Or TypeLicence.Text = "" Or leNomUrg.Text = "" Or TypeLicence.Text = "" Or lePaysUrg.Text = "" Or laVilleUrg.Text = "" Or leCPUrg.Text = "" Or lAdUrg.Text = "" Or leTelUrg.Text = "" Or lePrenomUrg.Text = "" Or autooperation.Text = "" Or laSante.Text = "" Or laSecu.Text = "" Or lePays.Text = "" Or laVille.Text = "" Or laDN.Text = "" Or leTel.Text = "" Or leMail.Text = "" Or lAdresse.Text = "" Then
MsgBox ("Veuillez terminer la saisie")
Else
'Identité adherent
Cells(BonneLigne, 1).Value = leNom.Text
Cells(BonneLigne, 2).Value = lePrenom.Text
Cells(BonneLigne, 3).Value = CDate(laDN.Text)
Cells(BonneLigne, 4).Value = leTel.Text
Cells(BonneLigne, 5).Value = leMail.Text
'Domicile adhérent
Cells(BonneLigne, 6).Value = lAdresse.Text
Cells(BonneLigne, 7).Value = leCP.Text
Cells(BonneLigne, 8).Value = laVille.Text
Cells(BonneLigne, 9).Value = lePays.Text
'Info médicales adhérent
Cells(BonneLigne, 10).Value = laSecu.Text
Cells(BonneLigne, 11).Value = laSante.Text
Cells(BonneLigne, 12).Value = autooperation.Text
'Info Personne Urgence
Cells(BonneLigne, 13).Value = leNomUrg.Text
Cells(BonneLigne, 14).Value = lePrenomUrg.Text
Cells(BonneLigne, 15).Value = leTelUrg.Text
Cells(BonneLigne, 16).Value = lAdUrg.Text
Cells(BonneLigne, 17).Value = leCPUrg.Text
Cells(BonneLigne, 18).Value = laVilleUrg.Text
Cells(BonneLigne, 19).Value = lePaysUrg.Text
'Info type de licence
Cells(BonneLigne, 20).Value = TypeLicence.Text
Cells(BonneLigne, 21).Value = DureeLicence.Text
End If
End Sub
Voici mon code qui me permet de ranger mes nouveaux adhérents
'Sélection de la plage à trier
Range("A3:A200").Select
'Lancement du tri, basé sur les données de la colonne A en ordre croissant
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
et voici le code qui me permet de ranger seulement ma première colonne