ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with macro triggered by worksheet change (https://www.excelbanter.com/excel-programming/416283-problem-macro-triggered-worksheet-change.html)

Alan[_8_]

Problem with macro triggered by worksheet change
 
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

Alan[_8_]

Problem with macro triggered by worksheet change
 
Never mind! I should have double-clicked on the worksheet name, not
the Workbook!


Don Guillett

Problem with macro triggered by worksheet change
 
You can RIGHT click the worksheet tabview codeuse the workSHEET_change
event

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Alan" wrote in message
...
Never mind! I should have double-clicked on the worksheet name, not
the Workbook!




All times are GMT +1. The time now is 05:26 PM.

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