Assigning a list of 1 item to a combobox object

ron2k

Board Regular
Joined
Jan 28, 2008
Messages
139
Hi guys,

With my following code, how can I assign a list value of only one (1) item. If I put a range of only 1 cell I get errors:
Code:
Private Sub Workbook_Open()
  With ThisWorkbook.Sheets("Comparison Summ").ComboBox1
    Select Case Environ$("USERNAME")
    Case "bwagner", "mpelayo", "dbadalez", "erosa", "msoa"
      .List = Sheets("Comparison Detail").Range("A23:A25").Value
    Case "ron2k_1"
      .List = Sheets("Comparison Detail").Range("A21:A35").Value
    Case "myboss"
      .List = Sheets("Comparison Detail").Range("A35").Value
    End Select
  End With
  With ThisWorkbook.Sheets("Comparison Detail").ComboBox1
    Select Case Environ$("USERNAME")
    Case "bwagner", "mpelayo", "dbadalez", "erosa", "msoa"
      .List = Sheets("Comparison Detail").Range("A23:A25").Value
    Case "ron2k_1"
      .List = Sheets("Comparison Detail").Range("A21:A35").Value
    Case "myboss"
      .List = Sheets("Comparison Detail").Range("A35").Value
    End Select
  End With
End Sub

Thanks,

Ron
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
What are the errors?

Try:
Code:
.ListFillRange = Sheets("Comparison Detail").Range("A35").Address
This should work for single and multiple list items.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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