none
VBA : Format date RRS feed

  • Question

  • Hello, im tyring to format a date so im using this line :

    lGraphSheet.Cells(5, 1).NumberFormat = "[$-en-CA]d mmm yyyy Hh:nn:Ss"

    But it doesnt like the nn (or Nn, same result), I get an error 1044.

    What im trying to do is pretty basic, but im stuck on that.

    Thanks


    • Edited by Mwouan7 Friday, June 9, 2017 6:02 PM
    Friday, June 9, 2017 4:20 PM

Answers

  •  "[$-en-CA]d mmm yyyy Hh:mm:Ss"

    Best Regards,
    Asadulla Javed,
    Jadavpore & Asansol

    • Marked as answer by Mwouan7 Friday, June 9, 2017 7:11 PM
    Friday, June 9, 2017 6:32 PM
    Answerer

All replies

  •  "[$-en-CA]d mmm yyyy Hh:mm:Ss"

    Best Regards,
    Asadulla Javed,
    Jadavpore & Asansol

    • Marked as answer by Mwouan7 Friday, June 9, 2017 7:11 PM
    Friday, June 9, 2017 6:32 PM
    Answerer
  • Ok thanks,

    my problem is that i was using the syntax from Format function (https://msdn.microsoft.com/en-us/library/office/gg251755.aspx), and it uses Nn for minutes.

    Its weird thats the behaviour is not consistent between Range.NumberFormat and Format function, but whatever

    Friday, June 9, 2017 7:12 PM