Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Passing a comboBox to a sub


I am trying to pass a comboBox to a sub to carry out sort on the items,
but I am having difficulty in doing this using the following...

Sub BubbleSortCombo(ByRef myCombo As MSForms.ComboBox)

Then call the sub()

BubbleSortCombo("ComboBox 1")
returns a type mismatch error I know it is to do with the different
type of control but can't figure it out. I am using a ComboBox from the
VB toolbox.

Can anyone help?


--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=536793

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Passing a comboBox to a sub

I think your problem might be that when you pass "ComboBox 1" you are not
actually passing it the combo box, you are passing the string "ComboBox 1"

Try calling the sub this way:

BubbleSortCombo(ComboBox1)

(Control names, like any variable name, cannot include spaces.)

Hopefully this helps.

"cmpcwil2" wrote:


I am trying to pass a comboBox to a sub to carry out sort on the items,
but I am having difficulty in doing this using the following...

Sub BubbleSortCombo(ByRef myCombo As MSForms.ComboBox)

Then call the sub()

BubbleSortCombo("ComboBox 1")
returns a type mismatch error I know it is to do with the different
type of control but can't figure it out. I am using a ComboBox from the
VB toolbox.

Can anyone help?


--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=536793


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Passing a comboBox to a sub


Thanks for the help it works fine now!!!:)


--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=536793

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
use selected value from one combobox to populate another combobox rjudge[_7_] Excel Programming 3 April 14th 06 02:01 PM
ComboBox list reliant on the entry from a different ComboBox ndm berry[_2_] Excel Programming 4 October 4th 05 04:40 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 07:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"