ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet_change (https://www.excelbanter.com/excel-programming/300685-worksheet_change.html)

rickey24[_3_]

Worksheet_change
 
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

--
Message posted from http://www.ExcelForum.com


Dave Peterson[_3_]

Worksheet_change
 
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

"rickey24 <" wrote:

Hi

I wanted to have a worksheet change event whenever I change a cell in a
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.
Bo

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson



All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com