Excel Crashes when trying to open a User Form

B

Brian

When I open the workbook and click on the worksheet to open the user form
excels stops working. I get Microsoft Office Excel has stopped working and is
trying find a solution, but it never does.

I have saved it in both 2007 & 2003 versions and both get the same problem.
What is odd is if you open the Userform Workbook, then open the VBA code
window, both userform versions run fine, but if you do not open the Code
window Excel locks up everytime.

Here is the code.

Sheet 2 Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
UserForm1.Show
End Sub

UserForm1 Code:
Private Sub UserForm_Initialize()

With Me.Address_21
.AddItem "1"
.AddItem "2"
.AddItem "3"
.AddItem "4"
.AddItem "5"
End With
End Sub
 
P

Peter T

There's nothing obviously wrong with the code in context with the limited
information you have given.

Regards,
Peter T
 
D

Dave Peterson

Can you try it on a different pc--either version of excel is ok with me.

If it works there, then I'd try cleaning my temp folder.

With excel closed
Windows start button|Run
type:
%temp%
and hit enter

Clean all those files that you can. (You may have some files in use, so skip
those.)

Then try your workbook again.

Heck, you could do this first. But if it doesn't work, I'd try the other pc,
too.

And if it didn't work there, then I'd create another small test workbook and see
if it was a corrupted workbook.

Good luck.
 
B

Brian

I cleared the temp folders out. For some reason after I get done updating the
workbook from the userform. When I go to change worksheets excel locks up.

My user form is a seperate workbook then the Spec workbook.

I am using the Userfom workbook to update several other workbooks. Each of
the other workbooks have 10-15 worksheets each. Can you think of any reasons
for a workbook with no code in it to lock up excel when you go to change from
1 worksheet to another?
 
B

Brian

I did run his code cleaner and that fixed the 1st problem. Before running the
code cleaner Excel locked up when you just tried to open the user form.

What exactly does the code cleaner do exactly?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top