Automated Drop down menu in excel

Joined
May 12, 2011
Messages
20
Reaction score
0
Hi,
I have created a macro which creates a drop down menu with some machine names.
I have also created macro for finding out different values corresponding to a partciular machine.
I want to run the second macro automatically once I select a machine name from the drop down menu...
Can you please help me in that??

Thanks a lot :bow:
 
Joined
May 11, 2011
Messages
14
Reaction score
0
I have not tried, but I think it should go something like this:

A1 = cell with the drop down menu

If Target.Adress = "$ A $ 1" then call second_macro()

if dosn't work try to replace "$ A $ 1" with Sheets("Sheet1).Cells(1,1) or something like that

I hope I have at least a little help with that
 
Joined
May 12, 2011
Messages
20
Reaction score
0
Thanks for the reply... But where should put this command?? In the VB code or in the cell where there is drop down menu?? Quite confused about that.. If it is in the VB Code, where should I put???
Could you please clear my doubts??:confused:
 
Joined
May 11, 2011
Messages
14
Reaction score
0
OK, let's go this way:

1. starting first macro
2. When he finishes, choose the name of the machine
3. starting 2nd macro

This is a procedure, yes?

So, when the first macro is finished, you just need to choose machine and the second macro will startes by itself.

Let say that the 2nd macro have name 2nd_macro

Sub starting_2nd_macro()
If Target.Adress=Sheets("Sheet1").Cells(1,1) then call 2nd_macro
end sub

This is also one macro, who started by himself and he just called 2nd.

I hope that I have no errors in syntax...

You can do also everything in one macro so that when you need to choose the name of a machine, macro throw 'dialog box' which seeks to enroll the name of machine


good luck
 
Joined
May 12, 2011
Messages
20
Reaction score
0
Thanks a lot... But one more doubt left... will the macro starting_2nd_macro() run automaticaaly as soon as the first macro finished exeuting and i select the machine name??
 
Joined
May 11, 2011
Messages
14
Reaction score
0
1st macro must finished, stop.

Then you choose machine name - this will by him self call this little macro

and then you have this formula

Targetadress - if you put something in this adress this macro will call 2nd macro.

I have something with this doing a long time ago, so i am not so sure that is OK syntax - i need to chek
 
Joined
May 12, 2011
Messages
20
Reaction score
0
In the VB Code I put the code that you gave after the first code. then i ran the first code and selected the machine name. but nothing happened. i had to run the code that you gave manually.. but an error "object required" came...
so i modified your code as below

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Adress = Sheets("Sheet1").Cells(1, 1) Then
Call 2nd_macro
End Sub

even then when i select the machine name its not running automatically..
could you please help me in that??:confused::(
 
Joined
May 11, 2011
Messages
14
Reaction score
0
try with this

If Target.Column = 1 And Target.Row = 1 Then
If ActiveSheet.Cells(Target.Row, Target.Column) <> "" Then call...
end if
 

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

Top