View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default trouble with subtracting elapsed times


Further to my previous post, there is another problem with dates in VBA. If
using dates from the worksheet, assign them to a VBA date variable first then
perform the calculations.

Dim time1 As Date
Dim time2 As Date

time2 = Sheets("Timing Sheet").Range("B6")

time1 = Now() - time2

Reason is that VBA becomes confused between the m/d/y and d/m/y formats but
assigning worksheet dates to a VBA variable first seems to work fine.

There are a number of areas in VBA where date problems occur.

--
Regards,

OssieMac