View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Geejay Geejay is offline
external usenet poster
 
Posts: 5
Default Start a macro from a change in a cell value made by a formula?

Hi Mike,
Many thanks for taking an interest in my problem, it is much appreciated.

I have added your code in above mine and will be able to test it on Monday.
I will let you know how I get on.

This is how it looks:

Public RunTime As Date

Sub MyCode()
RunTime = Now + TimeValue("00:00:20")
Application.OnTime RunTime, "MyCode"

Sub Macro8()
'Macro8 Macro
Range("D2:H2").Select
Selection.Copy
Sheets("Records 2").Select
Range("A2:E2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Rows("2:2").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub

Many thanks once again.
Geejay


"Mike H" wrote:

Hi,

It sounds line you need application.ontime

Once you start it running the code below will call itself recursively every
20 seconds until you stop it with CTRL+Break. There are programmatic ways of
stopping it if you want to develop this

Public RunTime As Date
Sub MyCode()
RunTime = Now + TimeValue("00:00:20")
Application.OnTime RunTime, "MyCode"

'YOUR CODE


End Sub


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Geejay" wrote:

I have a macro that records, 5 cells of data from an internet source and then
drops it down a line ready for the next time I push the button.

I would like to automate this procedure, recording every 20 seconds for
about 20 mins. I have created a timer that returns a '1' every 20 seconds and
a zero otherwise. The '1' is visible for one second.

I need help in marrying the timer,sourced from a formula, to the macro.

Can anyone help, bearing in mind that I am new to this.