Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why does Format(Now, “mm:ss”) fail in VBA erratically whereas the TEXT() worksheet function works?

0
Posted

Why does Format(Now, “mm:ss”) fail in VBA erratically whereas the TEXT() worksheet function works?

0

Microsoft Excel interprets the format “mm:ss” as minutes and seconds while Visual Basic interprets it as months and seconds. This is by design. To display minutes and seconds, Visual Basic requires the format to be specified as “nn:ss”. However, if your format string is “hh:mm:ss”, Visual Basic guesses correctly that you need hours, minutes and seconds! That explains the erratic behavior.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123