본문 바로가기
엑셀

ListBox1.AddItem

by llll시간여행llll 2021. 11. 24.

Private Sub UserForm_Activate()
ListBox1.AddItem
ListBox1.List(0, 0) = "포도"
ListBox1.List(0, 1) = 500


ListBox1.AddItem
ListBox1.List(1, 0) = "복숭아"
ListBox1.List(1, 1) = 400
ListBox1.AddItem
ListBox1.List(2, 0) = "수박"
ListBox1.List(2, 1) = 700
ListBox1.AddItem
ListBox1.List(3, 0) = "오렌지"
ListBox1.List(3, 1) = 450
ListBox1.AddItem
ListBox1.List(4, 0) = "레몬"
ListBox1.List(4, 1) = 550
ListBox1.AddItem
ListBox1.List(5, 0) = "바나나"
ListBox1.List(5, 1) = 550

ListBox1.ColumnCount = 2

End Sub

 

Private Sub ListBox1_Click()
TextBox1.Value = ListBox1.Value
TextBox2.Value = ListBox1.List(ListBox1.ListIndex, 1) ' 이게 생각이 안나서,,, 
End Sub

 

통합 문서1.xlsm
0.01MB