Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default Excel macro activation.

Kate

You can use the Change event, but I don't think it works on validation prior
to XL2000. You can check to see if the cell has validation using error
checking, then check the Value property of the Target (the cell that was
changed) for "B." It might look like this

Private Sub Worksheet_Change(ByVal Target As Range)

Dim x As Variant

On Error Resume Next
x = Target.Validation.ErrorMessage

If Err.Number = 0 Then
On Error GoTo 0
If UCase(Target.Value) = "B" Then
MsgBox "Do stuff"
End If
End If

End Sub

x is just a throw-away variable that's used to generate an error if there is
no validation in that cell. It will prevent the macro from running if
someone types a 'B' in a cell without validation as opposed to choosing it
from a validation list.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Kate Smith" wrote in message
om...
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
activation key LewisT Excel Discussion (Misc queries) 2 March 24th 10 05:27 AM
List activation on Excel bfbankpatrick Excel Worksheet Functions 1 February 4th 09 05:44 PM
Activation Request Harry Excel Discussion (Misc queries) 2 September 15th 07 05:22 AM
ctrl-click hyperlink activation in excel MPH55a Excel Discussion (Misc queries) 1 September 23rd 05 07:24 PM
"combination drop-down edit " form activation in Excel Trev Excel Discussion (Misc queries) 1 March 4th 05 03:26 AM


All times are GMT +1. The time now is 09:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"