View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rick S. Rick S. is offline
external usenet poster
 
Posts: 213
Default Listbox populating progmatically

I have this list (for a listbox), condensed for this query..
'=====================
Private Sub UserForm_Initialize()
Me.ListBox1.AddItem ("1")
Me.ListBox1.AddItem ("2")
Me.ListBox1.AddItem ("3")
Me.ListBox1.AddItem ("4")
Me.ListBox1.AddItem ("5")
End Sub
'================

How do I read from that list and create code to mimick the following.
'==============
With ListBox1
If .Value = "1" Then
If .Value = "2" Then
If .Value = "3" Then
If .Value = "4" Then
If .Value = "5" Then
End If
End If
End If
End If
End If
'some code goes here
End With
'===============

I would like to prevent constant editing of the macro to accomidate new
entries.

--
Regards

Rick
XP Pro
Office 2007