Reputation: 69
I'm currently trying to write a piece of code where the user is giving a text box to enter a date in the format dd/mm/yyyy and once that has been specified, I want to get the day before that date.
For example, the user enters 14/12/2018 and I would like VBA to store 13/12/2018 to another variable.
Probably a stupid query, but would be handy to know if this is possible.
Upvotes: 2
Views: 1190
Reputation: 69
Nevermind, I figured it out!
Here's what I did in case anyone wants to know:
Dim FirstRun as Date
Dim FirstRunBefore as Date
FirstRun = InputBox("Enter date")
FirstRunBefore = Format(DateAdd("d", -1, FirstRun), "dd mmmm yyyy")
Upvotes: 2