ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combobox (https://www.excelbanter.com/excel-programming/323627-combobox.html)

Teresa

Combobox
 
Hi,

I have a couple of macros which:

a) sort a list by client
b) sort a list by value

I need two options within the combo box
and when I choose option "SORT-CLIENT" the first macro is run

Thks



Bob Phillips[_6_]

Combobox
 
In two cells, say AA1 and AA2, put the values SORT-CLIENT and SORT-LIST,
select a combobox form the Forms toolbar, and right-click the combox to
select Format Control from the menu, and on the Control tab set the Input
Range texbox to AA1:AA2, and the Cell link textbox to AA3. OK out.

Add this macro to a general code module

Sub SortData()
If Worksheets("Sheet1").Range("AA3").Value ="SORT-CLIENT" Then
SortbyClientMacro
Else
SortByValueMacro
End If
End Sub

Now go back to the worksheet, right-click the combobox again, select Assign
Macro, and assign the above macro to the combobox.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"teresa" wrote in message
...
Hi,

I have a couple of macros which:

a) sort a list by client
b) sort a list by value

I need two options within the combo box
and when I choose option "SORT-CLIENT" the first macro is run

Thks





Teresa

Combobox
 
Thanks Bob - thats very helpful



"Bob Phillips" wrote:

In two cells, say AA1 and AA2, put the values SORT-CLIENT and SORT-LIST,
select a combobox form the Forms toolbar, and right-click the combox to
select Format Control from the menu, and on the Control tab set the Input
Range texbox to AA1:AA2, and the Cell link textbox to AA3. OK out.

Add this macro to a general code module

Sub SortData()
If Worksheets("Sheet1").Range("AA3").Value ="SORT-CLIENT" Then
SortbyClientMacro
Else
SortByValueMacro
End If
End Sub

Now go back to the worksheet, right-click the combobox again, select Assign
Macro, and assign the above macro to the combobox.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"teresa" wrote in message
...
Hi,

I have a couple of macros which:

a) sort a list by client
b) sort a list by value

I need two options within the combo box
and when I choose option "SORT-CLIENT" the first macro is run

Thks






Teresa

Combobox
 
Ive tried the below - howver doesnt seem to call CL, always calls "Value"

Thanks

Private Sub ComboBox1_Change()

If Worksheets("Sheet1").Range("AA3").Value = "C" Then
Call CL
Else
Call Value
End If
End Sub


"Bob Phillips" wrote:

In two cells, say AA1 and AA2, put the values SORT-CLIENT and SORT-LIST,
select a combobox form the Forms toolbar, and right-click the combox to
select Format Control from the menu, and on the Control tab set the Input
Range texbox to AA1:AA2, and the Cell link textbox to AA3. OK out.

Add this macro to a general code module

Sub SortData()
If Worksheets("Sheet1").Range("AA3").Value ="SORT-CLIENT" Then
SortbyClientMacro
Else
SortByValueMacro
End If
End Sub

Now go back to the worksheet, right-click the combobox again, select Assign
Macro, and assign the above macro to the combobox.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"teresa" wrote in message
...
Hi,

I have a couple of macros which:

a) sort a list by client
b) sort a list by value

I need two options within the combo box
and when I choose option "SORT-CLIENT" the first macro is run

Thks






Tom Ogilvy

Combobox
 
Try:

Private Sub ComboBox1_Click()

If Combobox1.value = "C" Then
Call CL
Else
Call Value
End If
End Sub

--
Regards,
Tom Ogilvy

"teresa" wrote in message
...
Ive tried the below - howver doesnt seem to call CL, always calls "Value"

Thanks

Private Sub ComboBox1_Change()

If Worksheets("Sheet1").Range("AA3").Value = "C" Then
Call CL
Else
Call Value
End If
End Sub


"Bob Phillips" wrote:

In two cells, say AA1 and AA2, put the values SORT-CLIENT and SORT-LIST,
select a combobox form the Forms toolbar, and right-click the combox to
select Format Control from the menu, and on the Control tab set the

Input
Range texbox to AA1:AA2, and the Cell link textbox to AA3. OK out.

Add this macro to a general code module

Sub SortData()
If Worksheets("Sheet1").Range("AA3").Value ="SORT-CLIENT" Then
SortbyClientMacro
Else
SortByValueMacro
End If
End Sub

Now go back to the worksheet, right-click the combobox again, select

Assign
Macro, and assign the above macro to the combobox.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"teresa" wrote in message
...
Hi,

I have a couple of macros which:

a) sort a list by client
b) sort a list by value

I need two options within the combo box
and when I choose option "SORT-CLIENT" the first macro is run

Thks








Teresa

Combobox
 
Thanks Tom - works fine

"Tom Ogilvy" wrote:

Try:

Private Sub ComboBox1_Click()

If Combobox1.value = "C" Then
Call CL
Else
Call Value
End If
End Sub

--
Regards,
Tom Ogilvy

"teresa" wrote in message
...
Ive tried the below - howver doesnt seem to call CL, always calls "Value"

Thanks

Private Sub ComboBox1_Change()

If Worksheets("Sheet1").Range("AA3").Value = "C" Then
Call CL
Else
Call Value
End If
End Sub


"Bob Phillips" wrote:

In two cells, say AA1 and AA2, put the values SORT-CLIENT and SORT-LIST,
select a combobox form the Forms toolbar, and right-click the combox to
select Format Control from the menu, and on the Control tab set the

Input
Range texbox to AA1:AA2, and the Cell link textbox to AA3. OK out.

Add this macro to a general code module

Sub SortData()
If Worksheets("Sheet1").Range("AA3").Value ="SORT-CLIENT" Then
SortbyClientMacro
Else
SortByValueMacro
End If
End Sub

Now go back to the worksheet, right-click the combobox again, select

Assign
Macro, and assign the above macro to the combobox.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"teresa" wrote in message
...
Hi,

I have a couple of macros which:

a) sort a list by client
b) sort a list by value

I need two options within the combo box
and when I choose option "SORT-CLIENT" the first macro is run

Thks









Dave D-C[_3_]

Combobox
 
steps:
1. create the combobox
2. populate the combobox
3. assign a routine to a combobox event
4. code the routine
Which step are you on?

you wrote:
I have a couple of macros which:

a) sort a list by client
b) sort a list by value

I need two options within the combo box
and when I choose option "SORT-CLIENT" the first macro is run



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


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

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