Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Starting a macro from a list selection

Hello. I've got a worksheet with a column of cells that are set up to select
from a list. What I'd like to do is to be able to execute a macro each time a
list item is selected. I've used methods like ".OnEntry" before to start a
macro each time a cell is updated, but that function does not seem to be able
to sense when a cell containing a list changes the selected list-item. Is
there something similar to the .OnEntry but for lists?
Thanks so much in advance for the help!
Rich
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 318
Default Starting a macro from a list selection

Hi
You can use the Worksheets Change event
For example if the cell in which you have data validation - which shows a
list then
the following code will print each of the selected values to your Immediate
window.
You can replace that with the execution of a macro
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells(1).Address = "$A$1" Then
Debug.Print Target.Cells(1).Value
End If
End Sub


"Rich_g" wrote:

Hello. I've got a worksheet with a column of cells that are set up to select
from a list. What I'd like to do is to be able to execute a macro each time a
list item is selected. I've used methods like ".OnEntry" before to start a
macro each time a cell is updated, but that function does not seem to be able
to sense when a cell containing a list changes the selected list-item. Is
there something similar to the .OnEntry but for lists?
Thanks so much in advance for the help!
Rich

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Starting a macro from a list selection

Thanks Alok. I just came across moments ago while searching through a post.
Wish I'd seen it earlier and not foolishly bothered everyone. Anyway, I tried
it and it works just great.

Thanks again!

"Alok" wrote:

Hi
You can use the Worksheets Change event
For example if the cell in which you have data validation - which shows a
list then
the following code will print each of the selected values to your Immediate
window.
You can replace that with the execution of a macro
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells(1).Address = "$A$1" Then
Debug.Print Target.Cells(1).Value
End If
End Sub


"Rich_g" wrote:

Hello. I've got a worksheet with a column of cells that are set up to select
from a list. What I'd like to do is to be able to execute a macro each time a
list item is selected. I've used methods like ".OnEntry" before to start a
macro each time a cell is updated, but that function does not seem to be able
to sense when a cell containing a list changes the selected list-item. Is
there something similar to the .OnEntry but for lists?
Thanks so much in advance for the help!
Rich

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 318
Default Starting a macro from a list selection

You are welcom.

"Rich_g" wrote:

Thanks Alok. I just came across moments ago while searching through a post.
Wish I'd seen it earlier and not foolishly bothered everyone. Anyway, I tried
it and it works just great.

Thanks again!

"Alok" wrote:

Hi
You can use the Worksheets Change event
For example if the cell in which you have data validation - which shows a
list then
the following code will print each of the selected values to your Immediate
window.
You can replace that with the execution of a macro
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells(1).Address = "$A$1" Then
Debug.Print Target.Cells(1).Value
End If
End Sub


"Rich_g" wrote:

Hello. I've got a worksheet with a column of cells that are set up to select
from a list. What I'd like to do is to be able to execute a macro each time a
list item is selected. I've used methods like ".OnEntry" before to start a
macro each time a cell is updated, but that function does not seem to be able
to sense when a cell containing a list changes the selected list-item. Is
there something similar to the .OnEntry but for lists?
Thanks so much in advance for the help!
Rich

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
How to copy or move a row on a particular dropdown list selection Patrice Excel Discussion (Misc queries) 1 October 11th 06 01:01 AM
Updating List selection on the fly Ninjapowa Excel Discussion (Misc queries) 0 September 20th 06 09:37 PM
validation list - filter based on selection jen Excel Worksheet Functions 2 June 22nd 06 02:52 AM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Making pick list conditional on selection from previous pick list Stewart Excel Discussion (Misc queries) 1 June 27th 05 11:30 AM


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

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"