Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / General Excel Questions / November 2007

Tip: Looking for answers? Try searching our database.

Excel, Macro, Drop down list

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ajgoodson - 14 Mar 2007 15:34 GMT
I have a list that I want to make into a drop down list that when each
individual item is selected, cause a macro to run.  Can anyone assist?
Ron de Bruin - 14 Mar 2007 15:59 GMT
Hi Ajgoodson

You can use Data>Validation to create the list
http://www.contextures.com/xlDataVal01.html

Then you can use the Change event to do what you want
http://www.cpearson.com/excel/events.htm

Example for cell A1

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
'call your macro here
End If
End Sub

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

>I have a list that I want to make into a drop down list that when each
> individual item is selected, cause a macro to run.  Can anyone assist?
Ajgoodson - 14 Mar 2007 16:18 GMT
I got the list created from the data valuation.  Thanks!

However, I am not familiar with the events thing you mentioned.  I am
looking to:
if cell A3 (list cell) = 1 then I want it to copy cells A8 through C8 to A4
through C4, if cell A3 (list cell) = 2 then I want it to copy cells A9
through C9 to A4 through C4.

Can this be done through the events, or some other way?

Thank you so very much for your help!

> Hi Ajgoodson
>
[quoted text clipped - 14 lines]
> >I have a list that I want to make into a drop down list that when each
> > individual item is selected, cause a macro to run.  Can anyone assist?
Ron de Bruin - 14 Mar 2007 16:52 GMT
Hi Ajgoodson

Right click on the sheet tab and choose "View Code"
Paste this event

Private Sub Worksheet_Change(ByVal Target As Range)
   If Not Application.Intersect(Range("A3"), Target) Is Nothing Then
       Select Case Target.Value
       Case 1: Range("A4:C4").Value = Range("A8:C8").Value
       Case 2: Range("A4:C4").Value = Range("A9:C9").Value
       End Select
   End If
End Sub

Alt q to go back to Excel

Try to change A3 now

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

>I got the list created from the data valuation.  Thanks!
>
[quoted text clipped - 26 lines]
>> >I have a list that I want to make into a drop down list that when each
>> > individual item is selected, cause a macro to run.  Can anyone assist?
Ajgoodson - 14 Mar 2007 17:13 GMT
I got that to work.  But it will not let me change the numbers 1 and 2 to
words.  Can I?

> Hi Ajgoodson
>
[quoted text clipped - 44 lines]
> >> >I have a list that I want to make into a drop down list that when each
> >> > individual item is selected, cause a macro to run.  Can anyone assist?
Ron de Bruin - 14 Mar 2007 17:19 GMT
Case "yourword" : Range("A4:C4").Value = Range("A8:C8").Value

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

>I got that to work.  But it will not let me change the numbers 1 and 2 to
> words.  Can I?
[quoted text clipped - 47 lines]
>> >> >I have a list that I want to make into a drop down list that when each
>> >> > individual item is selected, cause a macro to run.  Can anyone assist?
Ajgoodson - 14 Mar 2007 17:33 GMT
YOU ARE GREAT!

I have just one more question.

What if the ranges are both on different tabs?  i.e. tab1 and tab2?

Thank you so much!

> Case "yourword" : Range("A4:C4").Value = Range("A8:C8").Value
>
[quoted text clipped - 49 lines]
> >> >> >I have a list that I want to make into a drop down list that when each
> >> >> > individual item is selected, cause a macro to run.  Can anyone assist?
Ron de Bruin - 14 Mar 2007 17:39 GMT
No problem if you have the values of

Range("A8:C8") and Range("A9:C9") on another tab

Use this then
Case "yourword" : Range("A4:C4").Value = Sheets("YourOtherSheet").Range("A8:C8").Value

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

> YOU ARE GREAT!
>
[quoted text clipped - 57 lines]
>> >> >> >I have a list that I want to make into a drop down list that when each
>> >> >> > individual item is selected, cause a macro to run.  Can anyone assist?
Ajgoodson - 14 Mar 2007 17:50 GMT
IT WORKS! IT WORKS!

Thank you again...Have a great day!

> No problem if you have the values of
>
[quoted text clipped - 64 lines]
> >> >> >> >I have a list that I want to make into a drop down list that when each
> >> >> >> > individual item is selected, cause a macro to run.  Can anyone assist?
Torb - 28 Nov 2007 12:35 GMT
Hi,

I'm trying to take this to the next step, but i cant find any good pages.

What im aiming at is to have a front page (say sheet1) where I get a table from ex. sheet2 that contains happenings in november. If I change the table in sheet 1 I want this to be changed also in sheet2. Can this be done easy, and not with having a event for every cell?

EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com
Don Guillett - 28 Nov 2007 13:15 GMT
Building on "this" doesn't tell us what "this" is. You should always stay in
the original thread so we will know what you are talking about....

Signature

Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com

> Hi,
>
[quoted text clipped - 7 lines]
> EggHeadCafe - .NET Developer Portal of Choice
> http://www.eggheadcafe.com
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.