#1   Report Post  
Posted to microsoft.public.excel.misc
grahammal
 
Posts: n/a
Default ComboBox1


I have generated a ComboBox1 in a UserForm1.
I have a list of data in Sheets("DoNotUse").Range("L3", "L57").
How do I get that list into my ComboBox.

If it helps, this list is called 'grade' using 'Insert', 'Name',
'Define'.
Is a ComboBox the best thing to use or should I be using a ListBox?


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=524268

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default ComboBox1

One way is to use:

Option Explicit
Private Sub UserForm_Initialize()
With Me.ComboBox1
.List = ThisWorkbook.Worksheets("donotuse").Range("define" ).Value
End With
End Sub

If the cells contained values that were nicely formatted, you could add those
nicely formatted values to the combobox:

Option Explicit
Private Sub UserForm_Initialize()
Dim myCell As Range
Dim myRng As Range

Set myRng = ThisWorkbook.Worksheets("donotuse").Range("define" )

With Me.ComboBox1
For Each myCell In myRng.Cells
.AddItem myCell.Text
Next myCell
End With
End Sub




grahammal wrote:

I have generated a ComboBox1 in a UserForm1.
I have a list of data in Sheets("DoNotUse").Range("L3", "L57").
How do I get that list into my ComboBox.

If it helps, this list is called 'grade' using 'Insert', 'Name',
'Define'.
Is a ComboBox the best thing to use or should I be using a ListBox?

--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=524268


--

Dave Peterson
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



All times are GMT +1. The time now is 08:00 AM.

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"