1 Time UserForm

  • Thread starter Thread starter JimS
  • Start date Start date
J

JimS

I have a UserForm started by a UserForm.Show command in the "This
Workbook" Module.

How can I delete the "UserForm.Show" from the "This Workbook" Module
so that the userform will not start up the next time the workbook is
opened?

The Userform performs a Sort that I only want to function the 1 time
the workbook is opened only.

Thanks for any and all help...
 
Don't put the code in a form. Put it in the ThisWorkbook module. If you want
the code to run only once, you must allso modify the code to set the value of
a cell on the worksheet that indicates the sort has already been performed,
and check the value of that cell to determine whether the rest of the code
should execute.

But if it's a one-time thing, I don't understand why you have a macro for it,
rather than just running it manually.
 
Myrna , Thanks for your reply. I use the UserForm as a sort of 100's o
records by ~25 Sales Reps. I want to send only 1 File to everyone an
the UserForm enables them to sort for only their individual records.
need the UserForm not to load the second time they open the file afte
the inital sort.

Any other ideas?

Thanks agian... Jim
 
JimS:

Any other ideas?

I'm sure there are much better, tidier ways of doing this as I am a
rank amateur at this, but I did it as follows.

Set a value in a hidden cell: Sheet 1, AA1 = "1"
When the workbook is opened, it looks for the value in the cell. If
it's the "1", the form opens and also then changes the value to, say,
"0". If the check shows any value other than "1" in the cell, it skips
the UserForm1.Show line. Of course, you need to have the facility to
go back in to reset.

Steve
 

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

Back
Top