Trie dates après userform

M

MP de Limoges

Guest
Bonjous à toutes et à tous.
J'ai un petit souci. J'ai créé un userform qui me permet de saisir mes opérations bancaires. Une fois validées je souhaiterais trier ces infos en fonctions de la date, mon code ne marche pas ; de plus je souhaiterais que le format soit 01-janv-06, mais cela dépasse mes petites capacités. je joins mon code à toutes fins utiles. Merci pour votre aide. :silly:
Private Sub VALIDER_Click()
Dim voperationnum As Long
Sheets('OPERATION').Activate
ActiveSheet.Unprotect Password:='17121967'
Range('a1').End(xlDown).Select
voperationnum = Selection.Value + 1
ActiveSheet.Range('a1').End(xlDown).Offset(1, 0).Select
ActiveCell.Value = voperationnum
ActiveSheet.Range('b2').End(xlDown).Offset(1, 0).Select
With ActiveCell
.Value = vdate
Selection.NumberFormat = 'dd-mmmm-yy'
.Offset(0, 1).Value = Typeachat
If vcheque = True Then
.Offset(0, 2).Value = 'Chèque'
End If
If vprelvmt = True Then
.Offset(0, 2).Value = 'Prélèvement'
End If
If vcartebleuecora = True Then
.Offset(0, 2).Value = 'Carte Bleue ou Cora'
End If
If vautre = True Then
.Offset(0, 2).Value = 'Autre'
End If
.Offset(0, 3).Value = vN°operation
.Offset(0, 4).Value = vcommentaire
.Offset(0, 5).Value = vdebit
.Offset(0, 6).Value = vcredit
[I65536].Select
Selection.End(xlUp)(2).Select
ActiveCell.FormulaR1C1 = _
'=IF(RC[-2]='''',R[-1]C+RC[-1],IF(RC[-1]='''',R[-1]C-RC[-2],''''))'
End With
'Trier les données
Range('b3:H2000').Select
Selection.Sort Key1:=Range('B3'), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
Range('a1').Select
ActiveSheet.Protect Password:='17121967'
Typeachat = ''
vcheque = ''
vprelvmt = ''
vcartebleuecora = ''
vautre = ''
vN°operation = ''
vcommentaire = ''
vdebit = ''
vcredit = ''
Sheets('TABLEAU DE BORD').Activate
Range('a1').Select
End Sub
 

Blunet

XLDnaute Occasionnel
Ce petit code de formatage et de tri de date pourra peut être t'inspiré !

A+ [file name=TrieDateApresUF.zip size=13293]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/TrieDateApresUF.zip[/file]
 

Pièces jointes

  • TrieDateApresUF.zip
    13 KB · Affichages: 45

Discussions similaires

Statistiques des forums

Discussions
312 440
Messages
2 088 460
Membres
103 858
dernier inscrit
Rockaway