Bonjour le forum.
J'ai un petit souci. j'ai créé un userform pour saisir mes dépenses et me les classer par date sur une autre feuille. Tout se passe bien sauf que mes lignes ne sont absolument pas classé par date. Voici mon code:
Cela vient il du Number Format ??? j'y perd mon excel. Merci à tous ceux qui porteront attention à mon message.
Private Sub VALIDER_Click()
Dim voperationnum As Long
Application.ScreenUpdating = False
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
[b65536].Select
Selection.End(xlUp)(2).Select
With ActiveCell
Selection.NumberFormat = "m/d/yyyy"
.Value = vdate
.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 = Val(vdebit)
.Offset(0, 6).Value = Val(vcredit)
End With
Range("b3:b2012").Select
Selection.NumberFormat = "m/d/yyyy"
Range("B3:J2012").Select
Selection.Sort Key1:=Range("b3:j2100"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
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
J'ai un petit souci. j'ai créé un userform pour saisir mes dépenses et me les classer par date sur une autre feuille. Tout se passe bien sauf que mes lignes ne sont absolument pas classé par date. Voici mon code:
Cela vient il du Number Format ??? j'y perd mon excel. Merci à tous ceux qui porteront attention à mon message.
Private Sub VALIDER_Click()
Dim voperationnum As Long
Application.ScreenUpdating = False
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
[b65536].Select
Selection.End(xlUp)(2).Select
With ActiveCell
Selection.NumberFormat = "m/d/yyyy"
.Value = vdate
.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 = Val(vdebit)
.Offset(0, 6).Value = Val(vcredit)
End With
Range("b3:b2012").Select
Selection.NumberFormat = "m/d/yyyy"
Range("B3:J2012").Select
Selection.Sort Key1:=Range("b3:j2100"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
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