Populate ComboBox by a Row list

TdotW

New Member
Joined
Feb 15, 2017
Messages
7
Hi I'm trying to populate a ComboBox by a list of headings that go across a row. I've defined the list as a named range 'Properties' but can only seem to have the combobox display the 1st cell in the range.

Any tips?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You may need to create a hidden sheet or hide a column where you can transpose-paste your range. If you're using VB code on your form, you could use the TRANSPOSE function on the original range.
 
Upvote 0
My defined range is dynamic and I won't necessarily know the number of columns so unfortunately I can't do a straight copy and paste.
 
Upvote 0
I've tried tackling the problem using a command button with the following code, unfortunately I can't get it to work.

Code:
Sub Button3_Click()
    Dim PropertiesRange As Range
    
    Set Data = ActiveWorkbook.Sheets("Data")
    Set Dashboard = ActiveWorkbook.Sheets("Dashboard")
    
    LastColumn = Worksheets(1).Cells(15, Columns.Count).End(xlToLeft).Column

    Set ColumnRange = Data.Range(Cells(15, 7), Cells(15, LastColumn))
    
    ColumnRange.Copy
    Worksheets(2).Range("N1").PasteSpecial Transpose:=True

    
End Sub
 
Upvote 0
hi,
try

Code:
      Dim LastColumn As Long, ColumnRange As Variant
    
    LastColumn = Worksheets(1).Cells(15, Columns.Count).End(xlToLeft).Column
    ColumnRange = Application.Transpose(Data.Range(Cells(15, 7), Cells(15, LastColumn)).Value)
    
    Me.ComboBox1.List = ColumnRange


Dave
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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