|
-
Nov 19th, 2005, 07:05 PM
#1
Thread Starter
Junior Member
Need Help With Using/(finding) Timer in Excel !
okay here's the plan:
I need to write a macro for excel that will display a number ("B") real-time alongside a movie (it would be preferable for the movie to also play on the form using shockwave or something could someone please instruct me as to how to do that?) Here's a hypothetical first few lines of the data in Excel (A is the time, and B is the number that needs to be displayed):
VB Code:
A B
1 12.00.01 55
2 12.05.01 58
3 12.07.02 46
4 12.09.05 23
5 12.11.04 67
... (and so on for about umm several thousand lines)
What I need to do is use the timer to display the value of "B", after the correct interval of time. For example, the first value ("B1") appears immediatley, and then five seconds later I need for the value of "B2" to be displayed.
The interval between new numbers needs to be something like this (where x equals the row because I'm using a loop):
Right now (having never written a macro/program in VBA before) I am having trouble finding the "timer" control. There are hundreds of "Additional Controls" and I don't want to sort through them. I really have no idea what I am doing with VBA so thanks for the help in advance. Keep in mind that I have only taken Programming 1 last year, I am 15, and my VB skills are so incredibly limited, so if possible, please explain everything fully and don't assume that I know anything
-
Nov 20th, 2005, 12:17 AM
#2
Re: Need Help With Using/(finding) Timer in Excel !
Welcome to the Forums.
Thats because its not a control in Excel. Its just a function called Timer: Returns a Single representing the number of seconds elapsed since midnight.
Here is an example from the help file on how to use it.
VB Code:
Dim PauseTime, Start, Finish, TotalTime
If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
PauseTime = 5 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
Finish = Timer ' Set end time.
TotalTime = Finish - Start ' Calculate total time.
MsgBox "Paused for " & TotalTime & " seconds"
Else
End
End If
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 07:01 AM
#3
Re: Need Help With Using/(finding) Timer in Excel !
And, to add to RD's post, you can't put it in either (like you might do with other VB controls). At least, as far as I am aware. You have to do the "Get start point and check each interval" method as shown above by RD.
zaza
-
Nov 20th, 2005, 11:27 AM
#4
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
So it should look something like this?
VB Code:
Sub TEST1()
Dim PauseTime, Start, Finish, TotalTime
Dim x As Integer
For x = 1 To 10
Display.Caption = ("Bx") 'Display the number from cell Bx
PauseTime = ("Ax") ' Set duration (from cell Ax)
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents 'Pause
Loop
x = x + 1
Next x
End Sub
I get errors for like every other line and I have no idea how to debug them... thanks for helping btw
-
Nov 20th, 2005, 11:46 AM
#5
Re: Need Help With Using/(finding) Timer in Excel !
What are the errors?
Do you know that your declaring all your variables as a Variant? Thats what your doing on this line when you dont specify the type.
VB Code:
Dim PauseTime, Start, Finish, TotalTime
'Should be
Dim PauseTime Long, Start As Long '(, Finish, TotalTime) Not used
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 12:23 PM
#6
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
VB Code:
Sub TEST1()
Dim PauseTime As Long, Start As Long
Dim x As Integer
For x = 1 To 10
Display.Caption = ("Bx") 'Display the number [U][B]<-- run time error '424': object required[/B][/U]
PauseTime = ("Ax") 'Set duration [U][B]<-- run time error '13': type mismatch[/B][/U]
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents
Loop
x = x + 1
Next x
End Sub
-
Nov 20th, 2005, 12:25 PM
#7
Re: Need Help With Using/(finding) Timer in Excel !
Ok, where is your "Display" object? What is the Ax supossed to mean? Usually a time value is a long or single value type.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 12:56 PM
#8
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
The "Display" label is on a user form, and the "Ax" is supposed to represent a cell ie A1, A2 etc and the same for "Bx". I know that it's wrong... I just don't know quite how to get the program to recognize the value of a cell
-
Nov 20th, 2005, 01:00 PM
#9
Re: Need Help With Using/(finding) Timer in Excel !
Ok, where is "Sub TEST1()"? Is it behind the userform code or in a module or ThisWorkbook?
You can access a sheets cell by referenceing the workbook/sheet depending on where your trying to reference it from.
VB Code:
PauseTime = Workbooks("Book1").Sheets("Sheet1").Cells(1, 1) 'A1
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 01:19 PM
#10
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
the sub is in a module, so should it look like this?
VB Code:
Sub TEST1()
Dim PauseTime As Long, Start As Long
Dim x As Integer
For x = 1 To 10
PauseTime = Workbooks("Book1").Sheets("Sheet1").Cells(1, "x + 1") - Workbooks("Book1").Sheets("Sheet1").Cells(1, "x")
Display.Caption = Workbooks("Book1").Sheets("Sheet1").Cells(2, "x")
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents
Loop
x = x + 1
Next x
End Sub
-
Nov 20th, 2005, 01:22 PM
#11
Re: Need Help With Using/(finding) Timer in Excel !
Almost, "x + 1" and "x" should not have double quotes around them as we want the variable value to add to 1 and not be a complete string representation.
If your workbook is called "Book1" and your sheet is named "Sheet1" then yes.
To reference your Display label from a module - UserForm1.Display.Caption = "Something.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 01:35 PM
#12
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
Ok so I did everything that you said... (& my wrkbk is "Book1" and sheet is "Sheet1" and form is "UserForm1") and here is the current code:
VB Code:
Sub TEST1()
Dim PauseTime As Long, Start As Long
Dim x As Integer
For x = 1 To 10
PauseTime = Workbooks("Book1").Sheets("Sheet1").Cells(1, x + 1) - Workbooks("Book1").Sheets("Sheet1").Cells(1, x)
UserForm1.Display.Caption = Workbooks("Book1").Sheets("Sheet1").Cells(2, x)
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents
Loop
x = x + 1
Next x
End Sub
Now I can run it without error messages, but the for just sits there and the number stays as "0", which is the default number on "Display"... pretty much nothing happens.
-
Nov 20th, 2005, 01:46 PM
#13
Re: Need Help With Using/(finding) Timer in Excel !
Place a breakpoint on "TEST()", run your code and in your immediate window type these and post what value you get.
"?Workbooks("Book1").Sheets("Sheet1").Cells(1, x + 1)"
"?Workbooks("Book1").Sheets("Sheet1").Cells(2, x)"
"?PauseTime?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 02:01 PM
#14
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
oh noes I'm so confused... a breakpoint is that thing that happens when you click in the left margin next to a line and a circle appears and the line of code turns burgundy correct? I did that to the line Sub TEST1(), and ran it, but the line just turned yellow with a line pointing to it. Now what might this immediate window be?
-
Nov 20th, 2005, 02:13 PM
#15
Re: Need Help With Using/(finding) Timer in Excel !
Breakpoint is correct and the yellow highlighted line is the current line of execution that the program is going to execute. You can step through your code line by line by pressing F8.
The immediate window can be viewed by pressing Ctl+G.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 02:36 PM
#16
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
uuhhhmmm ok so I just did what I first did [make a breakpoint on sub TEST1() ] and then I went to the immediate window and typed in"?Workbooks("Book1").Sheets("Sheet1").Cells(1, x + 1)"
and pressed enter and a window popped up that said "Compile Error: Expected: Line number or label or statement of end of statement" Should the yellow line be on the line of code that I am refering to? Thanks for helping me through this
-
Nov 20th, 2005, 02:51 PM
#17
Re: Need Help With Using/(finding) Timer in Excel !
Dont use the double quotes as I used them just to show what to type. 
Press F8 once to advance the yellow line into the procedure to initialize the variables.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 02:54 PM
#18
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
?Workbooks("Book1").Sheets("Sheet1").Cells(1, x + 1)
0.1 (<-- that is correct at least)
?Workbooks("Book1").Sheets("Sheet1").Cells(2, x)
application defined or object defined error
?PauseTime?
expected: expression
-
Nov 20th, 2005, 02:59 PM
#19
Re: Need Help With Using/(finding) Timer in Excel !
So row 1, column 2 has 0.1 in it and row 2 column 1 has what in it?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 03:11 PM
#20
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
row 2, clm 1 has "0.51" in it, but heh I just figured out that the number I want displayed is in row 1 clm 2 and not row2 clm1 whoopsies so I guess that I got my clms and rows mixed up sorry
-
Nov 20th, 2005, 03:12 PM
#21
Re: Need Help With Using/(finding) Timer in Excel !
At least its straightened out now. So PauseTime should have a correct value in it now?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 04:13 PM
#22
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
Actually no I don't know why... here is the revised code with parts I just changed in bold (I don't think there are any glaring errors?):
VB Code:
Sub TEST1()
Dim PauseTime As Long, Start As Long
Dim x As Integer
For x = 1 To 10
PauseTime = Workbooks("Book1").Sheets("Sheet1").Cells[B](x + 1, 1)[/B] - Workbooks("Book1").Sheets("Sheet1").Cells[B](x, 1)[/B]
UserForm1.Display.Caption = Workbooks("Book1").Sheets("Sheet1").Cells[B](x, 2)[/B]
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents
Loop
x = x + 1
Next x
End Sub
?Workbooks("Book1").Sheets("Sheet1").Cells(x + 1, 1)
returns "0.1" ,however I just realized that it should be "0.51", because (x + 1 , 1) = A2 the first time through the loop, right? I guess that it isn't correct then :\
?Workbooks("Book1").Sheets("Sheet1").Cells(x , 2)
application-defined or object-defined error :S
?Workbooks("Book1").Sheets("Sheet1").Cells(x, 1)
application-defined or object-defined error
?PauseTime
returns "0"
no esta bien
-
Nov 20th, 2005, 04:23 PM
#23
Re: Need Help With Using/(finding) Timer in Excel !
Place a breakpoint on the PauseTime line of code. Then do the "?" printing of your cell values.
A2 for your first value, (2, 1) = row 2 column 1 or A2.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 04:31 PM
#24
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
Place a breakpoint on the PauseTime line of code. Then do the "?" printing of your cell values.
?Workbooks("Book1").Sheets("Sheet1").Cells(x, 1)
0.1 (correct)
?Workbooks("Book1").Sheets("Sheet1").Cells(x + 1 , 1)
0.51 (correct)
?Workbooks("Book1").Sheets("Sheet1").Cells(x, 2)
1 (correct)
?PauseTime
0 (I dont think thats correct)
-
Nov 20th, 2005, 04:34 PM
#25
Re: Need Help With Using/(finding) Timer in Excel !
Ok, since your working with decimal values you need to change your variable from a long to a single.
VB Code:
Dim PauseTime As Long
'Should be
Dim PauseTime As Single
0.51 - 0.1 = 0.41
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 10:21 PM
#26
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
I just changed PauseTime to single and tried to run the program and nothing happened besides the form showing up, but I placed a breakpoint on Pause Time etc and now I get
?PauseTime
0.41 (correct)
I can't find anything else that might be the problem... btw this code should be under "Module1" right? Or should it be under "UserForm1"?
Last edited by washcloth; Nov 20th, 2005 at 10:24 PM.
-
Nov 20th, 2005, 10:24 PM
#27
Re: Need Help With Using/(finding) Timer in Excel !
Step through your code checking the values from this line of code.
VB Code:
Do While Timer < Start + PauseTime
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 10:26 PM
#28
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
-
Nov 20th, 2005, 10:27 PM
#29
Re: Need Help With Using/(finding) Timer in Excel !
But as you step through the loop does the values ever change or evaluate to let it go inside the loop? or does it just bypass the loop altogether?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 10:37 PM
#30
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
yea I have to press f8 reall fast before that 0.41 of a second is up, but all the values are right on all the lines:
Do While Timer < Start + PauseTime
DoEvents
Loop
-
Nov 20th, 2005, 10:41 PM
#31
Re: Need Help With Using/(finding) Timer in Excel !
Well according to your code its only a pause loop so nothing is going to happen unless you increase the pause to some values that wil be noticeable.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 10:51 PM
#32
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
but wont it pause for the right interval? ie 0.41 secs? am I wrong?
-
Nov 20th, 2005, 10:53 PM
#33
Re: Need Help With Using/(finding) Timer in Excel !
Its probably too fast since its less then 1/2 a second.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 11:00 PM
#34
Re: Need Help With Using/(finding) Timer in Excel !
Isn't the timer in milliseconds?
-
Nov 20th, 2005, 11:01 PM
#35
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
Its probably too fast since its less then 1/2 a second.
I just tried changed the first ten increments to:
1 sec , 3, 5, 7, 9, 11, 13, 15, 17, and 19secs after beginning
and it still didn't work so I know that is probably not the problem
is that what you meant?
-
Nov 20th, 2005, 11:03 PM
#36
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
 Originally Posted by dglienna
Isn't the timer in milliseconds?
what do I do then??
-
Nov 20th, 2005, 11:07 PM
#37
Re: Need Help With Using/(finding) Timer in Excel !
I'm not sure about that as "Timer: Returns a Single representing the number of seconds elapsed since midnight."
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 11:16 PM
#38
Thread Starter
Junior Member
Re: Need Help With Using/(finding) Timer in Excel !
oh.... so does that mean that I can't work with fractions of a second?? because if so then that's not good at all
-
Nov 20th, 2005, 11:18 PM
#39
Re: Need Help With Using/(finding) Timer in Excel !
This is part of why I asked if your loop was working and what the values were.
VB Code:
Do While Timer < Start + PauseTime
If your pause time is fractional then it will always exit the loop and never go into it.
Why do you need such short durations?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 20th, 2005, 11:24 PM
#40
Re: Need Help With Using/(finding) Timer in Excel !
86,400 seconds in a day. It returns 2 decimal places, though. Prolly wouldn't help to try to gauge .41 seconds. I doubt it would register accurately. You could see how many times it was looping, though.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|