Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create new sheet based on instances of variables

Status
Not open for further replies.

RP1America

Technical User
Aug 17, 2009
221
US
For each UserID and PlanNumber combination, I would like to create a new worksheet and enter data into that worksheet (template).

Column C Column D Column E
UserID PlanNumber LotNumber
123456789 G11111 AB
123456789 G11111 X6
123456789 G11111 31
987654321 G11111 12
987654321 G11111 A3
123456789 G22222 G7
123456789 G22222 22

Given the example above, I would expect 3 separate spreadsheets to be created for each UserID/PlanNumber combination. I would also need to be able to reference and list the LotNumbers within the designated new sheet.

Any ideas of how to accomplish this?

I hope I am explaining it in a manner that is easy to comprehend my need. If not, just let me know and I will try to explain.

Thanks!
 


hi,

Spawning sheets/tables/charts is usually not a good idea, as it makes the maintenance and analysis of the workbook more difficult.

What is the reason that you could not use AutoFilter criteria to display a specific UserID/PlanNumber on one sheet?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I am attempting to automate this as much as possible. If I used an autofilter, wouldn't I need the user to input a UserID/PlanNumber combination?
 


So is the UserID the Network ID, that you could get via Environ("username") function?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
No, UserID is a list of client Social Security Numbers.
 


So how will the sheets be named?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Code:
Dim strNewSheetName As String
strNewSheetName = 'Will need to be able to value by PlanNumber here
   
    Sheets("Template").Copy after:=Worksheets(Worksheets.Count)
    ActiveSheet.Name = strNewSheetName
 

strNewSheetName = 'Will need to be able to value by PlanNumber here
Better think this out!

You have TWO separate ID/Plan for ONE PlanNumber in your example...
[tt]
123456789 G11111
987654321 G11111
[/tt]

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top