validation

  • Thread starter Thread starter bforster1
  • Start date Start date
B

bforster1

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
 
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
 

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

Back
Top