Excel macro activation.
Use the Change event of the worksheet, like this:
Private Sub Worksheet_Change(ByVal Target As Range) 'is changed cell in a certain region? If Union(Range("A1:G10"), Target).Address _ = "$A$1:$G$10" Then If Target.Cells(1).Value = "B" Then MsgBox "Cell changed to B" 'other stuff here! End If End If End Sub Add the above code to the worksheet module. Cheers, Dave. -----Original Message----- Here is my problem. I have a dropdown list in multiple cells that I've created using data validation feature. For example, my list contains 3 items: A,B,and C. I also have a macro that I want to run but ONLY if the user chooses item B from the list. If he/she chooses either items A or C, I don't want the macro to run. Since my list contains words, I don't know if there's a way of triggering a macro with a keyword as opposed to attaching it to some sort of a button. There are many rows that use this dropdown list and I was trying to see if there's a way of doing that without having to create buttons. I greatly appreciate any suggestions. Thanks. Kate. . |
All times are GMT +1. The time now is 10:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com