View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Fill a ListBox with items using VBA

You need to qualify the control name with the sheet name; e.g.:

Sheet1.ListBox_1

--

Vasant

wrote in message
om...
Hi!

I would like to attach a ListBox, and/or a ComboBox to one of my
Sheets, "NOT A USERFORM".
How can I fill this ComboBox or ListBox with Items using VBA??

Sub Help()
Dim X As Single 'X could be 200
Dim Myarray() As Variant
'I have 1 ListBox named ListBox_1 and
'1 ComboBox named ComboBox_1 in my Sheet

MyArray=Array("AAA","BBB","CCC","DDD","EEE","FFF", "GGG","HHH")
FOR X=lbound(MyArray) to Ubound(MyArray)
ListBox_1.AddItem Myarray(X)
ComboBox_1.AddItem Myarray(X)
Next X

End Sub


This does not Work, Any Help???