View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Listbox RowSource problem

Casey,
It should be Userform_Initialize not Userform1: see my
previous posting.

"Casey" wrote:


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