Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Drop Down List and macros

Hi all!

I was wondering if I can use a drop down list to run a macro. For
example, Cell A5 has a drop down box I created using Data...Validation
from the menu bar in Excel and selected "Allow List" to create a drop
down list of 3 Values: "Yes","No","Maybe" - now, here's what I'd like
to do. If I ever select "No", I want a macro to to be run. If I select
"Maybe", I'd like a different macro to be run. Is this possible?

Thanks!

Haas

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default Drop Down List and macros

pretty crude but will do it:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Range("A5").Value
If Range("A5").Value = "no" Then
Call Macro4
Else
If Range("A5").Value = "yes" Then
Call Macro5
Else
If Range("A5").Value = "maybe" Then
Call Macro6
Else
If Range("A5").Value = "" Then
Exit Sub
End If
End If
End If
End If
End With
End Sub


Corey....
wrote in message
oups.com...
Hi all!

I was wondering if I can use a drop down list to run a macro. For
example, Cell A5 has a drop down box I created using Data...Validation
from the menu bar in Excel and selected "Allow List" to create a drop
down list of 3 Values: "Yes","No","Maybe" - now, here's what I'd like
to do. If I ever select "No", I want a macro to to be run. If I select
"Maybe", I'd like a different macro to be run. Is this possible?

Thanks!

Haas



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Drop Down List and macros

Haas
This macro will do that. Note that nothing will happen if you select "Yes"
in A5. Note that this macro is a sheet macro and must be placed in the
sheet module of your sheet. To access that module, right-click on the sheet
tab, select View Code, and paste this macro into that module. "X" out of
the module to return to your sheet. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
If Not Intersect(Target, Range("A5")) Is Nothing Then
If Target.Value = "No" Then Call ThisMacro
If Target.Value = "Maybe" Then Call ThatMacro
End If
End Sub
wrote in message
oups.com...
Hi all!

I was wondering if I can use a drop down list to run a macro. For
example, Cell A5 has a drop down box I created using Data...Validation
from the menu bar in Excel and selected "Allow List" to create a drop
down list of 3 Values: "Yes","No","Maybe" - now, here's what I'd like
to do. If I ever select "No", I want a macro to to be run. If I select
"Maybe", I'd like a different macro to be run. Is this possible?

Thanks!

Haas



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Drop Down List and macros

Thanks for all your help. Both methods worked. Gotta say, you guys know
your stuff! Much thanks!

Haas

Otto Moehrbach wrote:
Haas
This macro will do that. Note that nothing will happen if you select "Yes"
in A5. Note that this macro is a sheet macro and must be placed in the
sheet module of your sheet. To access that module, right-click on the sheet
tab, select View Code, and paste this macro into that module. "X" out of
the module to return to your sheet. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
If Not Intersect(Target, Range("A5")) Is Nothing Then
If Target.Value = "No" Then Call ThisMacro
If Target.Value = "Maybe" Then Call ThatMacro
End If
End Sub
wrote in message
oups.com...
Hi all!

I was wondering if I can use a drop down list to run a macro. For
example, Cell A5 has a drop down box I created using Data...Validation
from the menu bar in Excel and selected "Allow List" to create a drop
down list of 3 Values: "Yes","No","Maybe" - now, here's what I'd like
to do. If I ever select "No", I want a macro to to be run. If I select
"Maybe", I'd like a different macro to be run. Is this possible?

Thanks!

Haas


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
Drop down list and macros? Anders[_2_] Excel Discussion (Misc queries) 2 November 30th 09 06:50 PM
Yes no drop down list and macros Larry Fitch Excel Discussion (Misc queries) 4 November 19th 09 04:40 PM
Create Drop Down List of Macros Youlan Excel Discussion (Misc queries) 2 October 23rd 09 11:34 PM
ASSIG MACROS TO DROP DOWN LIST CaOrAl Excel Discussion (Misc queries) 7 January 6th 07 11:28 AM
Delete key not enabled on macros drop down list carol49 Excel Discussion (Misc queries) 3 August 27th 06 08:43 PM


All times are GMT +1. The time now is 08:36 AM.

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

About Us

"It's about Microsoft Excel"