View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Rick Hansen Rick Hansen is offline
external usenet poster
 
Posts: 104
Default Listbox RowSource problem

Hey Casey, Topper is Correct, Change UserForm1_Intialize() to
UserForm_Intialize(). This a event procedure for the UserForm.


"Casey" wrote in
message ...

Rick,
Thanks for the reply but no joy.
Maybe I'm putting the code in the wrong place. What I did was right
click the UserForm1 that contains my Listbox and picked view code and
pasted your code in there with the following changes.

Option Explicit

Sub UserForm1_Initialize()
Dim Ws As Worksheet
Dim x As Integer

Set ws1 = Worksheets("Scopes") ''<< Change to Sheet Name
Me.ListBox1.Clear
Me.ListBox1.RowSource = ""

For x = 1 To 8 '' Col's A thru H
Me.ListBox1.AddItem ws1.Cells(1, x)
Next x

End Sub

But when I run the code the UserForm shows but the ListBox is empty.


--
Casey


------------------------------------------------------------------------
Casey's Profile:

http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=515450