#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 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





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 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








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default 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 =----
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
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
combobox changes value flow23 Excel Discussion (Misc queries) 0 May 11th 06 04:44 PM
combobox value flow23 Excel Discussion (Misc queries) 0 April 26th 06 12:21 PM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM
Populating combobox from another combobox David Goodall Excel Programming 1 September 12th 04 03:42 PM


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

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"