Creating New Worksheets & Sorting Order of Worksheets

O

Orion Cochrane

I have a file with tracking information. One worksheet has the names of all
the people I am tracking, each with their own worksheet. I also have a
UserForm that is used to add people. I would like the following 2 things to
happen (more than likely in my cmdOK_Click event):
1 - Copy a worksheet from one of my existing people, blank out the info, and
rename it the value in my Name field in my UserForm (I used to know how to do
this, but it was last year when I last had the code);
2 - Sort the placement of the worksheets with the people I'm tracking so it
is in the same order as my master worksheet with all the people listed. (I do
not want all the worksheets reordered; just the ones for the people I'm
tracking.)

Any help on this is greatly appreciated, as others will be using this file.
TIA.
 
D

Dave Peterson

#1. I think I would create a template worksheet (and hide it???). It could be
set up perfectly, but without the data.

Then use that to create the new worksheet.

You can record a macro when you do the copy and rename to get the code.

#2. Chip Pearson and David McRitchie share code to sort sheets:

Chip Pearson's:
http://www.cpearson.com/excel/sortws.htm

David McRitchie's:
http://www.mvps.org/dmcritchie/excel/buildtoc.htm#sortallsheets

If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)
 

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