0

When I use the following, I get:

  • MsgBox(date) - 01/04/
  • ?date in the immediate window, the same - 01/04/
  • ?year(date) - 2015
  • ?now - 01/04/ 07:18:19

I'm confused. My Macbook Pro is set to English and would display as 01/04/2015. I can't see any settings in Excel that would cause this.

Am I missing something obvious?

zeel
  • 3,268
  • 6
  • 37
  • 51

1 Answers1

0

Right click the cell, choose format cells. Select date, and choose how you wish to format the date.

Excel tries to automate formatting the cell as it sees fit. Format Cells overrides that per cell.

LPChip
  • 61,264
  • Cell formatting isn't the issue. If I use vba to assign the "date" function to a cell it displays correctly: (01/04/15). However, when I try and display it with MsgBox (or Immediate Window) is when I see the problem. – pedro-the-fisherman Apr 01 '15 at 12:16
  • Yeah, thats normal behavior. If you want to display it in a messagebox whitin vba, format the date there. – LPChip Apr 01 '15 at 12:42