PDA

View Full Version : timer code



naga_raaju
03-09-2010, 12:04 AM
hi ,

i need to call the ones_Click(),twos_Click() methods alternatively for every 10 seconds .

my code is


Public RunWhen As Double
Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, 10)
Application.OnTime EarliestTime:=RunWhen, Procedure:="twos_Click", Schedule:=True

End Sub

Private Sub ones_Click()
Sheet1.Range("A1").Value = "1"
Sheet1.Range("A2").Value = "2"
Sheet1.Range("A3").Value = "3"
Sheet1.Range("A4").Value = "4"
Sheet1.Range("A5").Value = "5"
Sheet1.Range("A6").Value = "6"
End Sub
Private Sub twos_Click()
For i = 1 To 6
For j = 1 To 7
Sheet1.Cells(i, j).ClearContents
Next
Next
StartTimer
End Sub



but not working please help me

GTO
03-09-2010, 12:57 AM
Greetings naga_raaju,

I see that while you joined last October, this is your first post. So let me be the first to say Welcome! vbaexpress is a great forum, and I'm sure you'll be glad you joined

Now I hate to bring this up with your first ever post here, but this appears to be a cross-post (albeit under a different username) of what's at:

http://www.mrexcel.com/forum/showthread.php?t=453324

Presuming that is correct, please read Here (http://www.excelguru.ca/node/7)

As you will note from Mr. Puls article, it is not that cross-posting is 'bad' per se, but that one is expected to give the first site a fair chance before cross-posting, and if a cross-post becomes necessary, provide links in ea thread to the other.

I hope that seems sensible, as I'm sure it was just something you were unaware of.

Anyways, again, Welcome, and a friendly 'Howdy' from Arizona.

Please note taht I did answer at the other trhead.

Mark

naga_raaju
03-09-2010, 06:01 AM
hi thnaks for yor reply.

i am very sorry for that but i don't have any alternate so that i posted cross.

any how i need ur help to learn the new things in VBA

have a nice day

bye
Naga