Hi everyone,
I've been stumped by this for a while now: when I try to convert a date value form mm/dd/yyyy to mm-dd-yyyy, and output it as a message box, the code works perfectly. However, when I try to put this value into a cell, it reverts back to the original formatting of mm/dd/yyyy. I know this probably has something to do with maybe the default format setup of the worksheet, but I don't know how to fix it.
Thanks in advance, working with dates in VBA has always resulted in a ton of frustration for me
I've been stumped by this for a while now: when I try to convert a date value form mm/dd/yyyy to mm-dd-yyyy, and output it as a message box, the code works perfectly. However, when I try to put this value into a cell, it reverts back to the original formatting of mm/dd/yyyy. I know this probably has something to do with maybe the default format setup of the worksheet, but I don't know how to fix it.
Thanks in advance, working with dates in VBA has always resulted in a ton of frustration for me

Code:
myfiledate = format(dateresult, "mm-dd-yyyy")
MsgBox myfiledate
Range("Z1").Value = myfiledate