Help with ColumnWidths

WrldIntlR

New Member
Joined
Jul 30, 2011
Messages
41
Hello! First time poster, long time steal-all-your-code-r.

I have a combobox in a userform that's supposed to pull two values from two different box. One is the numeric value of a code, and the second is the text discription of that code. I want a single combo box that has the code and the value both included, which I accomplished via the following code:

Code:
For Each cCount In RefData.Range("cboOCCcode")
  With Me.cboOCCnc
    .AddItem cCount.Value
    .List(.ListCount - 1, 1) = cCount.Offset(0, 1).Value
  End With
Next cCount

Which fills the combo box nicely. Now the problem here is that unless I use the columnwidths property, I get something that looks like this:

Code:
"CODE                                         VALU"

in the combo box where VALU is the cut-off version of what VALUE should be.

When I attempt to use the ColumnWidths property, it seems like regardless what I put, I end up with only column 2 showing value.

Code:
 Me.cboOCCnc.ColumnWidths = ("1;3")

Is my current iteration, but I've used several. Any help would be greatly appreciated!

Thanks,
James
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hahah ok nevermind. I was using Inches instead of Twips (whatever those are). New question though: Is there a way to change a justification of a column within the combobox? I'd like the 1st column to be justified right and the second column justified left. Thanks!
 
Upvote 0
I believe the answer to that is no.

You could use a fixed-pitch font (Courier, Consolas, ...) and do it yourself.
 
Upvote 0

Forum statistics

Threads
1,224,557
Messages
6,179,508
Members
452,918
Latest member
Davion615

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top