View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default use Excel Now() in VBA

Hi,

You could use the 'timer' function in vb which measures elapsed time and
providing you not using a Mac it will return the fractional part of a second.

Start = Timer
For x = 1 To 10000000: Next
elapsedtime = Timer - Start
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"zip22" wrote:

Excel's Now() function has a resolution down to hh:mm:ss.00 where the VBA Now
function only has hh:mm:ss. I need the accuracy of the excel now function in
a macro but

application.worksheetfunction.now

does not work. My workaround at this point is referencing a cell with
"=now()" in it, but before I reference it I have to use application.calculate
so it updates. Is there a better way to do this?