View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Run A Macro based on changes in cell

right click on the sheet tab and select View code

At the top of the resulting module (the sheet module), in the left dropdown
select Worksheet and in the left dropdown select calculate.

this will put in a sub declaration like:

Private Sub Worksheet_Calculate()

End Sub


You can put in code like
Private Sub Worksheet_Calculate()
if Range("D11").Value < 4 then
mymacro
End If
End Sub


This will run your macro everytime there is a calculate event and D11 is <
to 4. I imagine that is not exactly what you want - perhaps only when it
changes from 4 to < to 4, but you haven't supplied that type of
information.

--
Regards,
Tom Ogilvy


"Pete" wrote in message
...
I want to be able to run a existing macro on a spreadsheet
I created, based on the information in cell "D11" being <
4.

I know this can be done, but I am not sure what the code
should look like in order for it work properly.

One note that I don't know if it matters or not, but cell
D11 has a formula assigned to it.

Any help is appreciated
Pete