View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default How to Run VBA Code on cell or range change

You test for your range

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
' do your stuff
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"MikeZz" wrote in message
...
I want to run some code whenever someone changes a value in a particular
cell
or range. I know how to do it on Worksheet_Change but don't want to have
it
actually run code (slowing response down) every time any cell changes.

Is there a way to do this?

Thanks,
MikeZz