Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

Speed of direct link

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan - 15 Apr 2008 10:19 GMT
Hi,
I get data updating from two sources on the same sheet, and I am intersted
to check which on os faster - the difference will be in milliseconds. Is
there a way to do that in Excel.
Many thanks,
Dan
Joel - 15 Apr 2008 11:32 GMT
Sub mytime()
Const MSec = 86400000
Dim MSeconds As Double
Dim Time_Diff As Double

starttime = Time()

'your code

endtime = Time()

Time_Diff = endtime - starttime

'with time, 1 equal 1 day.
'to get milliseconds
'24 * 60 * *60 * 1000
MSeconds = Time_Diff * MSec

End Sub

> Hi,
> I get data updating from two sources on the same sheet, and I am intersted
> to check which on os faster - the difference will be in milliseconds. Is
> there a way to do that in Excel.
> Many thanks,
> Dan
Dan - 15 Apr 2008 11:45 GMT
Thank you, but my problem is to catch the event in change in the direct feed
data - it is not coming from code but just a function (such ar RTGET()...).

> Sub mytime()
> Const MSec = 86400000
[quoted text clipped - 22 lines]
> > Many thanks,
> > Dan
Joel - 15 Apr 2008 12:04 GMT
Not sure what RTGET() is.  Is this a workssheet function?

If it is a worksheet function then try this

on worksheet do this
=Testtime()

in VBA
function testTime()
Const MSec = 86400000
Dim MSeconds As Double
Dim Time_Diff As Double

Starttime = Time()
TestTime =  RTGET()
EndTime = Time

starttime = Time()

'your code

endtime = Time()

Time_Diff = endtime - starttime

'with time, 1 equal 1 day.
'to get milliseconds
'24 * 60 * *60 * 1000
MSeconds = Time_Diff * MSec

msgbox "exection Time is : " & MSeconds

end function

> Thank you, but my problem is to catch the event in change in the direct feed
> data - it is not coming from code but just a function (such ar RTGET()...).
[quoted text clipped - 25 lines]
> > > Many thanks,
> > > Dan
Joel - 15 Apr 2008 14:19 GMT
ActiveWorkbook.SaveAs Filename:="C:\TEMP\Book1.xml", _
      FileFormat:=xlXMLSpreadsheet

> Thank you, but my problem is to catch the event in change in the direct feed
> data - it is not coming from code but just a function (such ar RTGET()...).
[quoted text clipped - 25 lines]
> > > Many thanks,
> > > Dan
Dan - 15 Apr 2008 14:24 GMT
?

>     ActiveWorkbook.SaveAs Filename:="C:\TEMP\Book1.xml", _
>        FileFormat:=xlXMLSpreadsheet
[quoted text clipped - 28 lines]
> > > > Many thanks,
> > > > Dan
Ivyleaf - 15 Apr 2008 16:11 GMT
> ?
>
[quoted text clipped - 32 lines]
>
> - Show quoted text -

Hi,

Sorry to say, but Dan's method won't work for you since although the
theory is sound, VBA's Time() function is only accurate to one second,
no matter how much you divide it down. The following ver similar
method however should give you the accuracy you need:

Option Explicit
Private Declare Function timeGetTime Lib "winmm.dll" () As Long

Sub TimeDiff()
 Dim StartTime As Long, elTime As Double

 StartTime = timeGetTime()

   'Do whatever here

 elTime = (timeGetTime() - StartTime) / 1000

 MsgBox "That took " & elTime & " seconds."

End Sub

If you are trying to test the speed of an Excel function, you will
have to write a UDF or something that acts as a wrapper to the
function.

Cheers,
Ivan.
Ivyleaf - 15 Apr 2008 16:12 GMT
> > ?
>
[quoted text clipped - 64 lines]
>
> - Show quoted text -

Oops... sorry, I meant Joel's method. Sorry Dan.

Cheers,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.