Problem with macro triggered by worksheet change

A

Alan

I`m pretty new to VBA in Excel. What I`m trying to do is to
trigger a macro when the user changes a value in a particular column
(uses a drop-down list).

I created the following macro in VBE by double-clicking on "This
Workbook", clicking on "(General)" in the left drop-down of the bottom
window, and selecting "Workbook Change" in the right drop-down list.

The macro is:

Private Sub Workbook_Change(ByVal target As Range)
If target.Column = 9 Then MsgBox "OK"
End Sub

I also tried putting quotes around the 9 ("9") and using the
letter of the column ("I").

The result is that nothing happens when I make a new selection in
the drop-down list in that column. I only have one worksheet, and it
is active.

What am I missing? Thanks, Alan
 
D

Don Guillett

You can RIGHT click the worksheet tab>view code>use the workSHEET_change
event
 

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

Top