Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default MultiColumn ComboBox Display

Greetings,

I have a UserForm ComboBox with a RowSource of 27 rows and 20 columns.

How can I get only the values in the 4th column to be displayed in the
drop down window? Is this possible?

Anyone have any ideas, thoughts or links related to this question?

Any help will be appreciated.

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default MultiColumn ComboBox Display

One way is to set the ColumnCount to 4 and the ColumnWidths to 0;0;0

--
Tim Zych
www.higherdata.com
Compare data in workbooks and find differences with Workbook Compare
A free, powerful, flexible Excel utility

"Minitman" wrote in message
...
Greetings,

I have a UserForm ComboBox with a RowSource of 27 rows and 20 columns.

How can I get only the values in the 4th column to be displayed in the
drop down window? Is this possible?

Anyone have any ideas, thoughts or links related to this question?

Any help will be appreciated.

-Minitman



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default MultiColumn ComboBox Display

Hey Tim,

Thanks for the reply.

Question: By changing the column count, won't that be limiting the
number of columns in the row source?

I can see the column width should effectively hide the first three
columns, that is a real help!!!

I was wondering, if I made the 4th column as wide as the ComboBox
without limiting the number of columns, wouldn't that, in effect, give
me the appearance of only the 4th column appearing in the ComboBox?

Again, thanks for the pointer on the column widths.

-Minitman
On Fri, 30 May 2008 17:02:16 -0700, "Tim Zych"
<tzych@NOSp@mE@RTHLINKDOTNET wrote:

One way is to set the ColumnCount to 4 and the ColumnWidths to 0;0;0

--
Tim Zych
www.higherdata.com
Compare data in workbooks and find differences with Workbook Compare
A free, powerful, flexible Excel utility

"Minitman" wrote in message
.. .
Greetings,

I have a UserForm ComboBox with a RowSource of 27 rows and 20 columns.

How can I get only the values in the 4th column to be displayed in the
drop down window? Is this possible?

Anyone have any ideas, thoughts or links related to this question?

Any help will be appreciated.

-Minitman



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default MultiColumn ComboBox Display

ColumnCount limits only the display and you still have access to the hidden
columns. You can see by selecting a value in the combo, then running:

MsgBox Me.ComboBox1.List(Me.ComboBox1.ListIndex, 15)

which will display the 16th column of the selected row. Does not matter that
ColumnCount = 4.

I was wondering, if I made the 4th column as wide as the ComboBox
without limiting the number of columns, wouldn't that, in effect, give
me the appearance of only the 4th column appearing in the ComboBox?


I don't think so. To achieve that effect, you might need to resort to
something like:

Private Sub UserForm_Initialize()
Dim i As Integer, ColWidth As String
For i = 1 To Range(Me.ComboBox1.RowSource).Columns.Count
If i = 4 Then
ColWidth = ColWidth & Me.ComboBox1.Width & ";"
Else
ColWidth = ColWidth & 0 & ";"
End If
Next
ColWidth = Left(ColWidth, Len(ColWidth) - 1)
Me.ComboBox1.ColumnWidths = ColWidth
End Sub

IMO easier to do it the other way.

--
Tim Zych
www.higherdata.com
Compare data in workbooks and find differences with Workbook Compare
A free, powerful, flexible Excel utility

"Minitman" wrote in message
...
Hey Tim,

Thanks for the reply.

Question: By changing the column count, won't that be limiting the
number of columns in the row source?

I can see the column width should effectively hide the first three
columns, that is a real help!!!

I was wondering, if I made the 4th column as wide as the ComboBox
without limiting the number of columns, wouldn't that, in effect, give
me the appearance of only the 4th column appearing in the ComboBox?

Again, thanks for the pointer on the column widths.

-Minitman
On Fri, 30 May 2008 17:02:16 -0700, "Tim Zych"
<tzych@NOSp@mE@RTHLINKDOTNET wrote:

One way is to set the ColumnCount to 4 and the ColumnWidths to 0;0;0

--
Tim Zych
www.higherdata.com
Compare data in workbooks and find differences with Workbook Compare
A free, powerful, flexible Excel utility

"Minitman" wrote in message
. ..
Greetings,

I have a UserForm ComboBox with a RowSource of 27 rows and 20 columns.

How can I get only the values in the 4th column to be displayed in the
drop down window? Is this possible?

Anyone have any ideas, thoughts or links related to this question?

Any help will be appreciated.

-Minitman





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default MultiColumn ComboBox Display

Cool!!!

That was one of the gaps in my knowledge of vba. With this I can load
my TextBoxes from the ComboBox list & display only the column I need
in the ComboBox.

Thank you, that helps a lot.

-Minitman


On Fri, 30 May 2008 18:52:08 -0700, "Tim Zych"
<tzych@NOSp@mE@RTHLINKDOTNET wrote:

ColumnCount limits only the display and you still have access to the hidden
columns. You can see by selecting a value in the combo, then running:

MsgBox Me.ComboBox1.List(Me.ComboBox1.ListIndex, 15)

which will display the 16th column of the selected row. Does not matter that
ColumnCount = 4.

I was wondering, if I made the 4th column as wide as the ComboBox
without limiting the number of columns, wouldn't that, in effect, give
me the appearance of only the 4th column appearing in the ComboBox?


I don't think so. To achieve that effect, you might need to resort to
something like:

Private Sub UserForm_Initialize()
Dim i As Integer, ColWidth As String
For i = 1 To Range(Me.ComboBox1.RowSource).Columns.Count
If i = 4 Then
ColWidth = ColWidth & Me.ComboBox1.Width & ";"
Else
ColWidth = ColWidth & 0 & ";"
End If
Next
ColWidth = Left(ColWidth, Len(ColWidth) - 1)
Me.ComboBox1.ColumnWidths = ColWidth
End Sub

IMO easier to do it the other way.


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
Populate a Multicolumn ComboBox with filtered range [email protected] Excel Programming 3 February 16th 07 01:52 AM
Multicolumn combobox Gromit Excel Programming 2 January 23rd 06 04:14 PM
MultiColumn ComboBox Paul Smith[_3_] Excel Programming 2 August 3rd 05 06:36 AM
MultiColumn ComboBox Value set/display Jim Zeeb[_2_] Excel Programming 5 June 13th 05 09:20 AM
Hiding a column in a multicolumn combobox Mike Jones Excel Programming 1 May 3rd 05 12:44 AM


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

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"