ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   ASSIG MACROS TO DROP DOWN LIST (https://www.excelbanter.com/excel-discussion-misc-queries/124305-assig-macros-drop-down-list.html)

CaOrAl

ASSIG MACROS TO DROP DOWN LIST
 
Hello and happy new year 2007 to you all,

I am working on a excel book for which I have created a series of
macros which will help me to short the info according to different
criteria, such as client name etc...

The idea is that the users can easily access the information they are
looking for. The next step is something I do not know how to go about.

I want to create a drop down list with, for instance, all the clients
and assign to each one its respective macros, in such a way that when
the user selects its client the corresponding macro will run.

I am fairly new to excel and know nothing about programming...could
somebody give me a hand or tell me if this is possible

Thank you in advance,

Aisak


Bob Phillips

ASSIG MACROS TO DROP DOWN LIST
 
You could create a combobox from the forms toolbar, link it to a cell
(right-click it, Format ControlControl, and set the Cell link to a cell),
and then in the assigned macro, check that cell

Sub myMacro()
With Activesheet.Range("A1")
If .Value = "value 1" Then
Call macro1
ElseIf .Value = "value 1" Then
Call macro2
'etc.
End If
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
ups.com...
Hello and happy new year 2007 to you all,

I am working on a excel book for which I have created a series of
macros which will help me to short the info according to different
criteria, such as client name etc...

The idea is that the users can easily access the information they are
looking for. The next step is something I do not know how to go about.

I want to create a drop down list with, for instance, all the clients
and assign to each one its respective macros, in such a way that when
the user selects its client the corresponding macro will run.

I am fairly new to excel and know nothing about programming...could
somebody give me a hand or tell me if this is possible

Thank you in advance,

Aisak




CaOrAl

ASSIG MACROS TO DROP DOWN LIST
 
Hello Bob,

Thank you for your answer. Sorry, but I quite not understand the
procedure..I have created the combobox as you state with all the months
(Jan to December) and have linked it to cell I2. When I select January
that cell shows the value "1" and december "12".

I have twelve Macros named from "January" to "December". Do I have to
create a new macro with the script you suggest below and instead of
.....Range("A1) i have to wirte ("I2")?

Thank you for your time!!!!!

Aisak


Bob Phillips ha escrit:
You could create a combobox from the forms toolbar, link it to a cell
(right-click it, Format ControlControl, and set the Cell link to a cell),
and then in the assigned macro, check that cell

Sub myMacro()
With Activesheet.Range("A1")
If .Value = "value 1" Then
Call macro1
ElseIf .Value = "value 1" Then
Call macro2
'etc.
End If
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
ups.com...
Hello and happy new year 2007 to you all,

I am working on a excel book for which I have created a series of
macros which will help me to short the info according to different
criteria, such as client name etc...

The idea is that the users can easily access the information they are
looking for. The next step is something I do not know how to go about.

I want to create a drop down list with, for instance, all the clients
and assign to each one its respective macros, in such a way that when
the user selects its client the corresponding macro will run.

I am fairly new to excel and know nothing about programming...could
somebody give me a hand or tell me if this is possible

Thank you in advance,

Aisak



Bob Phillips

ASSIG MACROS TO DROP DOWN LIST
 
Sorry mate, I forgot it returned the index, not the value.

You could modify the code to check the index

Sub myMacro()
With Activesheet.Range("I2")
Select Case .Value
Case 1: Call January
Case 2: Call February
'etc.
End If
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
oups.com...
Hello Bob,

Thank you for your answer. Sorry, but I quite not understand the
procedure..I have created the combobox as you state with all the months
(Jan to December) and have linked it to cell I2. When I select January
that cell shows the value "1" and december "12".

I have twelve Macros named from "January" to "December". Do I have to
create a new macro with the script you suggest below and instead of
....Range("A1) i have to wirte ("I2")?

Thank you for your time!!!!!

Aisak


Bob Phillips ha escrit:
You could create a combobox from the forms toolbar, link it to a cell
(right-click it, Format ControlControl, and set the Cell link to a
cell),
and then in the assigned macro, check that cell

Sub myMacro()
With Activesheet.Range("A1")
If .Value = "value 1" Then
Call macro1
ElseIf .Value = "value 1" Then
Call macro2
'etc.
End If
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
ups.com...
Hello and happy new year 2007 to you all,

I am working on a excel book for which I have created a series of
macros which will help me to short the info according to different
criteria, such as client name etc...

The idea is that the users can easily access the information they are
looking for. The next step is something I do not know how to go about.

I want to create a drop down list with, for instance, all the clients
and assign to each one its respective macros, in such a way that when
the user selects its client the corresponding macro will run.

I am fairly new to excel and know nothing about programming...could
somebody give me a hand or tell me if this is possible

Thank you in advance,

Aisak





CaOrAl

ASSIG MACROS TO DROP DOWN LIST
 
Thank you Rob,

You are being quite helpful, but sadly I am not...I wrote the script in
a new Macro (the one I assigned to the combobox) but it doesnt work. It
gives me a compilation error.

As I said I do not have a clue about programmin but I am obviously
doing smth wrong;

This is what I actually wrote in the macros

Sub A()
'
' A Macro
' Macro grabada el 02/01/2007 por Cruises9
'

'
With ActiveSheet.Range("I2")
Select Case .Value
Case 1: Call January
Case 2: Call February

End Select
End Sub


I´d appreacite if you could advice if what I´ve done is an insult to
myself

Cheers



Bob Phillips ha escrit:
Sorry mate, I forgot it returned the index, not the value.

You could modify the code to check the index

Sub myMacro()
With Activesheet.Range("I2")
Select Case .Value
Case 1: Call January
Case 2: Call February
'etc.
End If
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
oups.com...
Hello Bob,

Thank you for your answer. Sorry, but I quite not understand the
procedure..I have created the combobox as you state with all the months
(Jan to December) and have linked it to cell I2. When I select January
that cell shows the value "1" and december "12".

I have twelve Macros named from "January" to "December". Do I have to
create a new macro with the script you suggest below and instead of
....Range("A1) i have to wirte ("I2")?

Thank you for your time!!!!!

Aisak


Bob Phillips ha escrit:
You could create a combobox from the forms toolbar, link it to a cell
(right-click it, Format ControlControl, and set the Cell link to a
cell),
and then in the assigned macro, check that cell

Sub myMacro()
With Activesheet.Range("A1")
If .Value = "value 1" Then
Call macro1
ElseIf .Value = "value 1" Then
Call macro2
'etc.
End If
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
ups.com...
Hello and happy new year 2007 to you all,

I am working on a excel book for which I have created a series of
macros which will help me to short the info according to different
criteria, such as client name etc...

The idea is that the users can easily access the information they are
looking for. The next step is something I do not know how to go about.

I want to create a drop down list with, for instance, all the clients
and assign to each one its respective macros, in such a way that when
the user selects its client the corresponding macro will run.

I am fairly new to excel and know nothing about programming...could
somebody give me a hand or tell me if this is possible

Thank you in advance,

Aisak




Bob Phillips

ASSIG MACROS TO DROP DOWN LIST
 
Did you assign the macro A to the combobox, again by right-clicking it and
selecting Assign Macro from the menu?

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
ups.com...
Thank you Rob,

You are being quite helpful, but sadly I am not...I wrote the script in
a new Macro (the one I assigned to the combobox) but it doesnt work. It
gives me a compilation error.

As I said I do not have a clue about programmin but I am obviously
doing smth wrong;

This is what I actually wrote in the macros

Sub A()
'
' A Macro
' Macro grabada el 02/01/2007 por Cruises9
'

'
With ActiveSheet.Range("I2")
Select Case .Value
Case 1: Call January
Case 2: Call February

End Select
End Sub


I´d appreacite if you could advice if what I´ve done is an insult to
myself

Cheers



Bob Phillips ha escrit:
Sorry mate, I forgot it returned the index, not the value.

You could modify the code to check the index

Sub myMacro()
With Activesheet.Range("I2")
Select Case .Value
Case 1: Call January
Case 2: Call February
'etc.
End If
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
oups.com...
Hello Bob,

Thank you for your answer. Sorry, but I quite not understand the
procedure..I have created the combobox as you state with all the months
(Jan to December) and have linked it to cell I2. When I select January
that cell shows the value "1" and december "12".

I have twelve Macros named from "January" to "December". Do I have to
create a new macro with the script you suggest below and instead of
....Range("A1) i have to wirte ("I2")?

Thank you for your time!!!!!

Aisak


Bob Phillips ha escrit:
You could create a combobox from the forms toolbar, link it to a cell
(right-click it, Format ControlControl, and set the Cell link to a
cell),
and then in the assigned macro, check that cell

Sub myMacro()
With Activesheet.Range("A1")
If .Value = "value 1" Then
Call macro1
ElseIf .Value = "value 1" Then
Call macro2
'etc.
End If
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
ups.com...
Hello and happy new year 2007 to you all,

I am working on a excel book for which I have created a series of
macros which will help me to short the info according to different
criteria, such as client name etc...

The idea is that the users can easily access the information they are
looking for. The next step is something I do not know how to go
about.

I want to create a drop down list with, for instance, all the clients
and assign to each one its respective macros, in such a way that when
the user selects its client the corresponding macro will run.

I am fairly new to excel and know nothing about programming...could
somebody give me a hand or tell me if this is possible

Thank you in advance,

Aisak





Bob Phillips

ASSIG MACROS TO DROP DOWN LIST
 
Also, you are missing an End With

Sub A()
'
' A Macro
' Macro grabada el 02/01/2007 por Cruises9
'
With ActiveSheet.Range("I2")
Select Case .Value
Case 1: Call January
Case 2: Call February
End Select
End With '<===========
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
ups.com...
Thank you Rob,

You are being quite helpful, but sadly I am not...I wrote the script in
a new Macro (the one I assigned to the combobox) but it doesnt work. It
gives me a compilation error.

As I said I do not have a clue about programmin but I am obviously
doing smth wrong;

This is what I actually wrote in the macros

Sub A()
'
' A Macro
' Macro grabada el 02/01/2007 por Cruises9
'

'
With ActiveSheet.Range("I2")
Select Case .Value
Case 1: Call January
Case 2: Call February

End Select
End Sub


I´d appreacite if you could advice if what I´ve done is an insult to
myself

Cheers



Bob Phillips ha escrit:
Sorry mate, I forgot it returned the index, not the value.

You could modify the code to check the index

Sub myMacro()
With Activesheet.Range("I2")
Select Case .Value
Case 1: Call January
Case 2: Call February
'etc.
End If
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
oups.com...
Hello Bob,

Thank you for your answer. Sorry, but I quite not understand the
procedure..I have created the combobox as you state with all the months
(Jan to December) and have linked it to cell I2. When I select January
that cell shows the value "1" and december "12".

I have twelve Macros named from "January" to "December". Do I have to
create a new macro with the script you suggest below and instead of
....Range("A1) i have to wirte ("I2")?

Thank you for your time!!!!!

Aisak


Bob Phillips ha escrit:
You could create a combobox from the forms toolbar, link it to a cell
(right-click it, Format ControlControl, and set the Cell link to a
cell),
and then in the assigned macro, check that cell

Sub myMacro()
With Activesheet.Range("A1")
If .Value = "value 1" Then
Call macro1
ElseIf .Value = "value 1" Then
Call macro2
'etc.
End If
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
ups.com...
Hello and happy new year 2007 to you all,

I am working on a excel book for which I have created a series of
macros which will help me to short the info according to different
criteria, such as client name etc...

The idea is that the users can easily access the information they are
looking for. The next step is something I do not know how to go
about.

I want to create a drop down list with, for instance, all the clients
and assign to each one its respective macros, in such a way that when
the user selects its client the corresponding macro will run.

I am fairly new to excel and know nothing about programming...could
somebody give me a hand or tell me if this is possible

Thank you in advance,

Aisak





CaOrAl

ASSIG MACROS TO DROP DOWN LIST
 
Thank you Bob,

That really did the job!!! Great and thank you for your time!!!

PS: What I found out is that to include the code I had to click on the
combobox and then "assign macro" and then "New Macro".

It is working nicely

Thanks

Bob Phillips ha escrito:

Also, you are missing an End With

Sub A()
'
' A Macro
' Macro grabada el 02/01/2007 por Cruises9
'
With ActiveSheet.Range("I2")
Select Case .Value
Case 1: Call January
Case 2: Call February
End Select
End With '<===========
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
ups.com...
Thank you Rob,

You are being quite helpful, but sadly I am not...I wrote the script in
a new Macro (the one I assigned to the combobox) but it doesnt work. It
gives me a compilation error.

As I said I do not have a clue about programmin but I am obviously
doing smth wrong;

This is what I actually wrote in the macros

Sub A()
'
' A Macro
' Macro grabada el 02/01/2007 por Cruises9
'

'
With ActiveSheet.Range("I2")
Select Case .Value
Case 1: Call January
Case 2: Call February

End Select
End Sub


I´d appreacite if you could advice if what I´ve done is an insult to
myself

Cheers



Bob Phillips ha escrit:
Sorry mate, I forgot it returned the index, not the value.

You could modify the code to check the index

Sub myMacro()
With Activesheet.Range("I2")
Select Case .Value
Case 1: Call January
Case 2: Call February
'etc.
End If
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
oups.com...
Hello Bob,

Thank you for your answer. Sorry, but I quite not understand the
procedure..I have created the combobox as you state with all the months
(Jan to December) and have linked it to cell I2. When I select January
that cell shows the value "1" and december "12".

I have twelve Macros named from "January" to "December". Do I have to
create a new macro with the script you suggest below and instead of
....Range("A1) i have to wirte ("I2")?

Thank you for your time!!!!!

Aisak


Bob Phillips ha escrit:
You could create a combobox from the forms toolbar, link it to a cell
(right-click it, Format ControlControl, and set the Cell link to a
cell),
and then in the assigned macro, check that cell

Sub myMacro()
With Activesheet.Range("A1")
If .Value = "value 1" Then
Call macro1
ElseIf .Value = "value 1" Then
Call macro2
'etc.
End If
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CaOrAl" wrote in message
ups.com...
Hello and happy new year 2007 to you all,

I am working on a excel book for which I have created a series of
macros which will help me to short the info according to different
criteria, such as client name etc...

The idea is that the users can easily access the information they are
looking for. The next step is something I do not know how to go
about.

I want to create a drop down list with, for instance, all the clients
and assign to each one its respective macros, in such a way that when
the user selects its client the corresponding macro will run.

I am fairly new to excel and know nothing about programming...could
somebody give me a hand or tell me if this is possible

Thank you in advance,

Aisak





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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com