Worksheet Change Event

Damo10

Active Member
Joined
Dec 13, 2010
Messages
460
Hi,

I have some data validation in column AD which the user selects an item form a drop down list, I also have a worksheet change event which checks the formula result in column AG, this all works fine when the user selects the item from the drop down list however if the user types the item in the cell the worksheet change does not work. Is there a way around this?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
 If Intersect(Target, Range("AD:AD")) Is Nothing Then
 Exit Sub
 Else
 Dim x As Long
 Dim c As Range
 x = ActiveCell.Row
 Set c = Range("AD" & x).Offset(0, 3)
 If c.Text = "Error" Then
 MsgBox Chr(10) & Chr(10) & ("Tank Selection Error                    ") & Chr(10) & Chr(10) & "Please Check Selection" & Chr(10) & Chr(10), vbCritical, "Selection Error"
 With Application
 .Undo
 End With
 Exit Sub
 Else
 End If
End If

Regards
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
The Worksheet_Change event will fire whether the user types an entry in the cell or selects from a data validation dropdown. What makes you think that it isn't firing?
 
Upvote 0
Hi,

I have tested it several times and all the formulas work and all expected results in the other cell are correct but it just dosnt fire the change event when the item is typed int the cell, it only works when the item is selected from the data validation drop down list.

Regards
 
Upvote 0
Hi,

I have some data validation in column AD which the user selects an item form a drop down list, I also have a worksheet change event which checks the formula result in column AG, this all works fine when the user selects the item from the drop down list however if the user types the item in the cell the worksheet change does not work. Is there a way around this?

Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
 If Intersect(Target, Range("AD:AD")) Is Nothing Then
 Exit Sub
 Else
 Dim x As Long
 Dim c As Range
 x = ActiveCell.Row
 Set c = Range("AD" & x).Offset(0, 3)
 If c.Text = "Error" Then
 MsgBox Chr(10) & Chr(10) & ("Tank Selection Error                    ") & Chr(10) & Chr(10) & "Please Check Selection" & Chr(10) & Chr(10), vbCritical, "Selection Error"
 With Application
 .Undo
 End With
 Exit Sub
 Else
 End If
End If

Regards

When the user selects from the drop down list, the active cell is the cell with the drop down list. When the user types a value in a cell, they probably hit ENTER. The Active cell is the cell below the cell they just type in.
 
Upvote 0
Which version of Excel are you using? I don't have access to 2007 or 2010 where I am at the moment, but I can't reproduce your problem in Excel 2003. Are you sure that events are enabled at all times?
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,681
Members
452,937
Latest member
Bhg1984

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top