A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Thank you! This is just what I needed! :-)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I'm trying to use an Excel function called TODAY(). I wish to use it simple macro but it doesn't appear to be working. Here is my example:
Sub Test_Display_My_Date()
MsgBox Text(TODAY(), "mm, " - " dd, " - " yy")
End Sub
This macro returns a compile error: "Sub or Function not defined". Can someone explain what I am doing wrong?
Thanks,
Greg
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Thank you! This is just what I needed! :-)
TODAY() is an Excel worksheet function, but not a VBA function. The VBA equivalent is Date.
Similarly, TEXT is Excel only. The VBA equivalent is Format.
Sub Test_Display_My_Date()
MsgBox Format(Date, "mm - dd - yy")
End Sub