Date Data Type

Variables of the Date data type require 8 bytes of storage and are actually stored as decimal (floating-point) numbers that represent dates ranging from January 1, 100 to December 31, 9999 (no year 2000 problem here) and times from 0:00:00 to 23:59:59.

As discussed earlier, literal dates are enclosed within number signs, but when assigning a date to a date variable, we can also use valid dates in string format. For example, the following are all valid date/time assignments:

VBA has many functions that can manipulate dates and times. If you need to manipulate dates or times in your programs, you should probably spend some time with the Excel VBA help file. (Start by looking under "Date Data Type.")

0 0

Responses

  • malcolm
    What data type should we use for dates in vba macros?
    23 days ago

Post a comment