continual running of a macro


Posted by Kevin Gagnon on January 30, 2002 2:51 PM

I am trying to write a macro so that when the user changes a value it auto matically updates a value on the other page (i.e. If sheet1.range("A1") = 5 then sheet2.range("A1") = 6 ) I can get the macros to run when the workbook opens, or when the user presses the designated "Ctrl-(Key)" but i want it so that the macro starts when the workbook is opened and continually runs until the workbook is closed. How do I go about doing this?

Posted by Joe Was on January 30, 2002 3:05 PM

This is the code to work on one sheet. Any time any change is made it will do the code. Your code may require you to put this in ThisWorkbook or it may need to go in a sheet module.

Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Source As Range)

'This runs every time a sheet cell changed, add
'your code here!
'Do not change the name above or the code will fail.

End Sub

Hope this helps. JSW



Posted by Jeff on January 30, 2002 8:39 PM

How about using a formula? =Sheet1!A1+1