ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help its not working (https://www.excelbanter.com/excel-programming/362004-help-its-not-working.html)

steph28

Help its not working
 

I'm trying to add items into a listbox using the code:

Private Sub ListBox3_Click()

ListBox3.ColumnCount = 4
ListBox3.AddItem ("West")
ListBox3.AddItem (East)
ListBox3.AddItem (North)
ListBox3.AddItem (South)
ListBox3.ColumnWidths = 200
UserForm1.Show

End Sub

but when i run the macro the list box is empty!

--
steph2
-----------------------------------------------------------------------
steph28's Profile: http://www.excelforum.com/member.php...fo&userid=3463
View this thread: http://www.excelforum.com/showthread.php?threadid=54405


Christian[_8_]

Help its not working
 
Hi Steph

Try the following

Private Sub ListBox3_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
ListBox3.ColumnCount = 4
ListBox3.AddItem "West"
ListBox3.AddItem "East"
ListBox3.AddItem "North"
ListBox3.AddItem "South"
ListBox3.ColumnWidths = 200
UserForm1.Show
ListBox3.Clear 'This is to clear the Listbox otherwise it will load
the items every time

End Sub



All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com