I think this is a basic question but I do not find a way to solve my problem
I created this code :
Sub test()
Range("A11") = CDate(Evaluate("WORKDAY(TODAY(),-1)"))
Range("A11").NumberFormat = "yyyymmdd"
MsgBox Range("A11")
End Sub
But my problem is that the MsgBox do not take into account the NumberFormat "yyyymmdd", it shows "3/5/2021" instead of "20210305". It there a way to change the code so that when I write MsgBox Range("A11") it shows directly "20210305" ?
Thank you for your help.