VBA Half-Second Timer Help

Talk about your favorite PC games, Steam and building awesome custom rigs!

Moderator: Moderators

Post Reply
Positron
Posts: 53
Joined: Mon Mar 31, 2008 11:10 pm

VBA Half-Second Timer Help

Post by Positron »

Does anyone know how to make a timer for a half-second? I am trying to make a cell change colors twice a second. I have the basic clock code using the time format feature but can not get it to count a half-second. I did a little research and found something about using 500 as a time interval but can not find any more info on it otherwise. Any help will be appreciated. Thanks
HazmatB
Posts: 197
Joined: Wed Nov 28, 2007 6:23 pm

Post by HazmatB »

What language are you working in?
Positron
Posts: 53
Joined: Mon Mar 31, 2008 11:10 pm

Post by Positron »

It is just in Excel... VBA? I am not sure what you are asking. It is not like Java or C++ or anything like that if that is what you are asking.
jeffslot
Portablizer Extraordinaire
Posts: 853
Joined: Wed Jun 01, 2005 6:26 am
Location: PA
Contact:

Post by jeffslot »

Hi,

I think you might want to set the timer's interval property to 500 (because 1000 milliseconds = 1 second)

Then in the timer's tick event you will want to put your code to change colors in the cell.

I think that trick is to enable (timer1.enabled = true )the timer right when you want it to start counting. I hope this helps this is how I do it using vb.net.

Jeff
Does anyone know how to make a timer for a half-second? I am trying to make a cell change colors twice a second. I have the basic clock code using the time format feature but can not get it to count a half-second. I did a little research and found something about using 500 as a time interval but can not find any more info on it otherwise. Any help will be appreciated. Thanks
Positron
Posts: 53
Joined: Mon Mar 31, 2008 11:10 pm

Post by Positron »

Thank you for your reply... The thing is I do not how to do any of that. Do you think you can explain how to set it up or maybe direct me to a setp-by-step site? Thanks again
jeffslot
Portablizer Extraordinaire
Posts: 853
Joined: Wed Jun 01, 2005 6:26 am
Location: PA
Contact:

Post by jeffslot »

If I get some spare time tomorrow at work, I'll see if I can make you a sample.

Jeff
Positron
Posts: 53
Joined: Mon Mar 31, 2008 11:10 pm

Post by Positron »

Thank you. All the sites I found it only tells part of the solution and I am not sure how to even start. Any help will be appreciated
evilteddy
Portablizer
Posts: 423
Joined: Tue Mar 25, 2008 2:11 am
360 GamerTag: Kirren of Smeg
Steam ID: kizzinator
Location: Newcastle, Australia

Post by evilteddy »

VBA does not have a timer control making this sort of program much harder than it would need to be in a normal visual basic studio. Just google a timer control for vba and learn how to use it. That is unless Jeffslot comes up with an easy solution.
jeffslot
Portablizer Extraordinaire
Posts: 853
Joined: Wed Jun 01, 2005 6:26 am
Location: PA
Contact:

Post by jeffslot »

Yeah, I've noticed that there doesn't seem to be a 'Timer Control' in VBA (although I've read about some 3rd party ones you can download), I haven't really had the time yet to look at this issue. I did come across this article, I hope it is helpfull:

http://www.cpearson.com/excel/OnTime.aspx
Post Reply