Loggind cell entries in a list, 10 times, on a time interval

mcphatt

New Member
Joined
Jul 7, 2011
Messages
11
Hi all,

I have quite a specific problem to solve. Searching the forums I have found two solutions to the three aspects I need.

First, I need to have a macro that will copy a cell entry every time the cell changes into a column on another sheet. I have found the following code which sort of works, although it loops through the calculation then stops and lists all the entries, when I want only 1:

Private Sub Worksheet_Calculate()
With Sheets("LogSheet")
lr = .Cells(Rows.count, "A").End(xlUp).Row
If Range("D21").Value <> .Cells(lr, "A") Then
.Cells(lr + 1, "A").Value = Range("D21").Value
End If
End With
End Sub

I also want the macro to calculate every 30 seconds, for which I have this code:

Sub SaveThis()
Application.DisplayAlerts = False
ActiveSheet.Calculate
Application.DisplayAlerts = True
Application.OnTime Now + TimeValue("00:00:30"), "SaveThis"
End Sub

Which works, but I don't have a macro to stop it, and more precisely I want it to calculate every 30 seconds only ten times at a time.

Is there anyway to put all three criteria into one code - the cell logging in a list, calculate every 30 seconds for ten calculations, so that I end up with ten entries in a list on my log sheet, all calculated at the thrity second interval?

Thanks for your help in advance.

Matt
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hey all,

Now realised that the time event macro will just run and run, and even reopen my workbook, can anyone explain how to stop it?

Thanks!
 
Upvote 0

Forum statistics

Threads
1,224,579
Messages
6,179,656
Members
452,934
Latest member
mm1t1

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