Year showing 1899 instead of 2009

  • Thread starter Thread starter Bob Zimski
  • Start date Start date
B

Bob Zimski

How do I get the following to give me 2009 instead of 1899 in immediate window?

? Year(today)
produces 1899 rather than 2009
 
TODAY is a worksheet function, not a VB one. Use either one of these
instead...

? Year(Now)

? Year(Date)
 
Or try...
?year([today()])
--
Jim Cone
Portland, Oregon USA


"Bob Zimski"
<[email protected]>
wrote in message
How do I get the following to give me 2009 instead of 1899 in immediate window?

? Year(today)
produces 1899 rather than 2009
 
TODAY is a worksheet function, not a VB one. Use either one of these
instead...

? Year(Now)

? Year(Date)

In addition, under VBE - Tools - Options, check Require Variable
Declaration. That way VBA would not try to interpret 'today' as a variable.
And it's just good practice.
 
Back
Top