timer problem excel 2007

jetpack

Board Regular
Joined
Nov 4, 2010
Messages
81
I am using the following code to copy changes to a cell value every 30 seconds. The code works, sort of, but has the following bugs;

When timevalue = 5 seconds it copies every 5 seconds but copies the change into 5 cells at a time. It will only fill 64 rows and then stops copying.

If I change the value to 30 seconds, it only copies to 1 row at a time but still will not copy more than 64 rows.

In each case the bottom of the screen still shows copying message at the time interval even though no copying is taking place.

Any help will be greatly appreciated.

Code:
Option Explicit
Public dTime As Date

Sub ValueStore()
Dim dTime As Date
    Range("B" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Range("A1").Value
    Call StartTimer
    If Range("A1") > 275 Then Beep

End Sub


Sub StartTimer()
    dTime = Now + TimeValue("00:00:30")
    Application.OnTime dTime, "ValueStore", Schedule:=True
End Sub

Sub StopTimer()
    On Error Resume Next
    Application.OnTime dTime, "ValueStore", Schedule:=False
End Sub
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Tested here: I couldn't get it to write to five cells at a time but I agree it stops at row 64.

Change the assigment statement to:-
Code:
    Range("B" & Cells([COLOR=red][B]Rows.Count, 2[/B][/COLOR]).End(xlUp).Row).Offset(1, 0).Value = Range("A1").Value
I can't think what value Cells(Rows.Count).Row might return.
 
Upvote 0
Cells(Rows.Count).Row returns 64. When used without a column index the Cells property goes across then down, ie 1048576/16384 = 64. Use:

Code:
Range("B" & Rows.Count).End(xlUp).Offset(1, 0).Value = Range("A1").
 
Upvote 0
But it works up to (or should that be "down to") row 64. :confused:
</P>
 
Upvote 0
Thank you both for your replies.

I appreciate the explanation why it was stopping at row 64.

It is now continually copying, but still multiple rows, now on all time frames.

Question; Since the smallest timevalue interval is 1 second, is excel copying all the changes made during that 1 second? If so, is there any way to copy only the first change?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,440
Messages
6,124,882
Members
449,193
Latest member
PurplePlop

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top