ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   validation (https://www.excelbanter.com/excel-programming/312251-validation.html)

bforster1[_17_]

validation
 

how do I write code to have a macro "fire" when a validated cell i
changed? I have a list of three options in a validated cell and I wan
different macros to "fire" when different options are selected from th
validated cell list.

I am a newbie so as much detail as possible is appreciated.

Thanks

--
bforster
-----------------------------------------------------------------------
bforster1's Profile: http://www.excelforum.com/member.php...fo&userid=1177
View this thread: http://www.excelforum.com/showthread.php?threadid=26575


Tom Ogilvy

validation
 
right click on the sheet tab and select view code.

Use the Change event (in Excel 2000 and later)

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If target.Count 1 then exit sub
' is it the validated cell
if target.Address = "$B$9" then
Select Case Lcase(Target.Value)
Case "value1"
Macro1
Case "value2"
Macro2
Case "value3"
Macro3
End Select
End If
End Sub

See Chip Pearson's site for information on events
http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy

"bforster1" wrote in message
...

how do I write code to have a macro "fire" when a validated cell is
changed? I have a list of three options in a validated cell and I want
different macros to "fire" when different options are selected from the
validated cell list.

I am a newbie so as much detail as possible is appreciated.

Thanks.


--
bforster1
------------------------------------------------------------------------
bforster1's Profile:

http://www.excelforum.com/member.php...o&userid=11771
View this thread: http://www.excelforum.com/showthread...hreadid=265753





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

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