View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default UserForm Wont Load

Minitman

I don't know why there's a difference between versions. I would guess that
the problem here is unqualified references. I think you should re-write the
sub as

Dim i As Long
Dim lastrow As Long

With Sheets("CI")
lastrow = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 1 to lastrow
Me.GetCustInfo_ListBox_01_04.AddItem .Cells(i,1).Value
Next i
End With

I'll bet this takes care of the problem. Be sure to note the use of periods
in this code, they're important. If it doesn't solve the error, then I
would run the program again, get the error, hit debug so that the AddItem
line is highlighted, and go to the Immediate Window and type the following

?TypeName(Me.GetCustInfo_ListBox_01_04)
?.Cells(i,1).Parent.Name
?.Cells(i,1).Value

and see what you get.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Minitman" wrote in message
...
Hey Dick,

Thanks for that advice, that did indeed bring up more information.

The VB message box was the same. However, the debugger came up with
this:

Private Sub UserForm_Initialize()
Dim i As Integer
Application.ScreenUpdating = False
Sheets("CI").Activate
lastrow = Range("A65536").End(xlUp).Row
For i = 1 To lastrow
GetCustInfo_ListBox_01_04.AddItem Cells(i, 1) <<<

Next i
Application.ScreenUpdating = True
Sheets("Enter").Activate
End Sub

What I still don't understand is why it only has problems in the newer
version and works fine in the older!!!!

Any ideas????

-Minitman
On Mon, 26 Apr 2004 17:40:44 -0500, "Dick Kusleika"
wrote:

Minitman

It looks like you're saying the debugger highlights the Show line. If

so,
go to Tools - Options - General (in the VBE) and select "Break in Class
Modules" in the Error Trapping section. Whenever an error ends on a

class
instancing line (like Show) it usually means the error is in the class
module (the userform module, in this case) but that error trapping isn't

set
to go there. This will tell you which line is actually causing the

error.