unload Me compile error

C

Cinque Terra

I have a UserForm that is loaded by an Worksheet_SelectionChange event.
Since the listboxes in the form are loaded with relative values, I want to
unload the form when either the OK or Cancel button is clicked.

I've tried both "unload me" and "unload frm_spread" in the button click
events. When I input this into the code, "me" is updated to "Me" or
"frm_spread" is updated to "frm_Spread"; "unload" remains "unload" (it isn't
capitalized)

When I run the code, I get:
Compile error - wrong number of arguments or invalid property assignment.

I'm running excel 2007.

Thanks in advance for any help.
 
D

Dave Peterson

Since the code is behind the userform, you can use "UnLoad Me".

To get the capitalization correct (which doesn't really matter to excel/VBA),
you can do:

type this on a blank line in your code:
dim UnLoad
(and hit enter)
then delete this line

=========
But....

You have a different problem. You have a sub or a function in your code that is
named unload (all lower case). You'll want to change the name of that procedure
and then adjust all the lines that call that procedure.
 

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

Similar Threads


Top