Worksheet_change

R

rickey24

Hi

I wanted to have a worksheet change event whenever I change a cell in
certain column (say column B) to something else the event would happen
I figure this

Private Sub Worksheet_Change(ByVal Target As Range)

????

If ????? and Target.Column = 2 then
Application.EnableEvents = False
Code, code
End if

Application.EnableEvents = True

End Sub

Thanks.
B
 
D

Dave Peterson

How about:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("b:b")) Is Nothing Then Exit Sub

On Error GoTo errHandler:

'do lots of stuff
Application.EnableEvents = False
'change some stuff.




errHandler:
Application.EnableEvents = True

End Sub
 
Top