Forum Discussion
Andrew_Hinson
Apr 18, 2023Brass Contributor
VBA - Insert current time PLUS one minute
Hi everyone, I'm really sorry; I keep asking questions on here but never actually respond to anyone else's queries. I'm still an absolute amateur and can't help myself let alone anyone else. So I...
HansVogelaar
Apr 18, 2023MVP
One option is to format the cell as hh:mm. The date part will still be present, but not shown in the cell:
Sub TimePlusOne
On Error Resume Next
With ActiveCell
.Value = DateAdd("n", 1, Now)
.NumberFormat = "hh:mm"
End With
End Sub
If you prefer to enter only the time in the cell:
Sub TimePlusOne()
Dim t As Date
On Error Resume Next
t = Now
With ActiveCell
.Value = DateAdd("n", 1, t - Int(t))
.NumberFormat = "hh:mm"
End With
End Sub
Andrew_Hinson
Apr 19, 2023Brass Contributor
Hans you are a genius!
Thank you so much 🙂
Can you recommend any books/videos that would be good for me to start learning VBA?
Thank you so much 🙂
Can you recommend any books/videos that would be good for me to start learning VBA?
- HansVogelaarApr 19, 2023MVP
You'll find a series of tutorials at Excel-Easy
If you'd like a book: Excel VBA Programming For Dummies (don't be put off by the title, it's a serious book).