Worksheet_change

  • Thread starter Thread starter rickey24
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top