Bonjour,
J'ai besoin d'aide dans ma macro excel, je dois prendre une date dans une cellule, la stocker en tant que date puis l'utiliser dans un filtre.
Or le problème survient quand je veux convertir ma date du format européen au format américain... Le problème étant qu'il ne reconnais plus 'd' (la variable) en tant qu'un date.
Si quelqu'un aurait une solution, je suis preneur !
Merci d'avance !
PS : Voici le code et une échantillion de mes données (Je n'ai pas vraiment de le droit d'en dire beaucoup) :)
Sub searchRefund()
'
' searchRefund Macro
'
'
Dim r, i As Long
Dim d
i = 2
Sheets("Stripe").Select
'
Do Until IsEmpty(Cells(i, 1)) = True
'Check type to be 'Charge'
If Cells(i, 1).Value = "Charge" Then
Cells(i, 3) = Format(Cells(i, "B"), "mm/dd/yyyy")
End If
'Check type to be 'Refund'
If Cells(i, 1).Value = "Refund" Then
'ActiveCell.Offset(, 2).NumberFormat = "mm/dd/yyyy"
Cells(i, 3) = Format(Cells(i, "B"), "mm/dd/yyyy")
'Selection.EntireRow.Insert
Sheets("Stripe").Select
Cells(i, 1).Select
d = ActiveCell.Offset(, 2).Date
r = ActiveCell.Offset(, 3).Value
MsgBox (d)
MsgBox (r)
Sheets("Ventes 2022").Select
ActiveSheet.Range("$A$1:$AB$12569").AutoFilter Field:=1, Criteria1:=Array( _
"="), Operator:=xlFilterValues, Criteria2:=Array(2, d)
Cells(1, 1).Select
Selection.End(xlDown).Select
Selection.EntireRow.Insert
ActiveSheet.Range("$A$1:$AB$12568").AutoFilter Field:=1
End If
i = i + 1
Loop
End Sub
Type | ID | Created |
Charge | 684365 | 16/01/2022 |
Charge | 684566 | 16/01/2022 |
Refund | 684567 | 17/01/2022 |