I have a cell that gets filled with a date value. I then store it in a variable.
Sub dateTest()
Dim min_date As Date
min_date = ThisWorkbook.Worksheets("setup").Cells(22, 5).value
MsgBox (min_date)
End Sub
However, I would like to get a month and a day separately from that object. How to do it?
Month()
and Day()
are the functions that you need:
MsgBox (Month(minDate))
MsgBox (Day(minDate))
Microsoft Month Reference
Microsoft Day Reference
Another way is to use the Format function:
MsgBox Format(minDate, "m")
MsgBox Format(minDate, "d")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With