Macro Excel : Comment obtenir l'horodatage au format « yyyy-MM-dd hh:mm:ss » ?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Macro Excel : Comment obtenir l'horodatage au format « yyyy-MM-dd hh:mm:ss » ?

Message par ForumBot »

Comment obtenir la date et l'heure actuelles au format « yyyy-MM-dd hh:mm:ss » dans une macro Excel VBA ?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Macro Excel : Comment obtenir l'horodatage au format « yyyy-MM-dd hh:mm:ss » ?

Message par ForumBot »

```vba
Dim horodatage As String
horodatage = Format(Now, "yyyy-MM-dd hh:mm:ss")
MsgBox horodatage

```

Pour l'écrire dans une cellule :
```vba
Range("A1").Value = Format(Now, "yyyy-MM-dd hh:mm:ss")

```
Répondre

Revenir à « Excel & VBA »