View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Run Macro on Change

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.address = "$D$5" Then FindInv
End Sub
--
HTH...

Jim Thomlinson


"Ken Hudson" wrote:

I have the following code in Sheet1. When I change data in cell D5, it
invokes the FindInv macro. If I then try to clear a range of cells in Sheet1,
say D3:D4, the code below runs again and I get a type mismatch error. What do
I need to do to prevent this?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target = Range("D5") Then FindInv
End Sub


Thanks.
--
Ken Hudson