View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Steven Steven is offline
external usenet poster
 
Posts: 6
Default Don't add item in combobox ...

You can add a worksheet into your workbook with all the combo box
options and populate it using variables.

For example, this piece of code populates all the week numbers in my
week number combo box with the values I've placed in column A. And my
reporting unit combo box with the values from column G.

Does this help?



Private Sub UserForm_Initialize()


Dim WeekList As String, icount As Integer, ReportList As String

icount = 2

While Worksheets("Variables").Range("A" & icount).Value < ""

WeekList = Worksheets("Variables").Range("A" & icount).Value

cboWeek.AddItem WeekList

icount = icount + 1

Wend

icount = 2


While Worksheets("Variables").Range("G" & icount).Value < ""

ReportList = Worksheets("Variables").Range("G" & icount).Value

cboReporting.AddItem ReportList

icount = icount + 1

Wend

End Sub