VBA to create new worksheets from a template, populate the new worksheet by copying data from another sheet to specific locations.

BigPaws

New Member
Joined
Jun 17, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello All You VBA Experts, :)

Like so many others, I am relatively new to VBA. I have a code that will take Test Case data from my "Working", create new a worksheet from the Template, name it and populate it correctly. However, it will only add one Test Case with up to four Steps, I need to be able to add multiple Test Cases and multiple steps to each new spreadsheet. On the attached samples I have added color coding just to help demonstrate where the data on the Working sheet would populate on the new template. The Working Overview image is a zoomed out view of the data on the Working sheet. The Working Close-Up gives you a better look at the data and headers. Each row on the Working sheet is a Test Case, the columns after L are for the steps of the test case. All Test Cases with the same TabName (column A) and/or Plan information (columns B-D) will be on the same worksheet. Columns A through D will all be the same for all Test Cases that will go on the same worksheet. This example would have four new worksheets created with four test cases on each one and looking like the Completed Sample image when done. You'll notice on the Template the test cases are now in columns and the step information is now in the rows. A Plan/worksheet can gave 1 to over 100 test cases and 2 to over 20 steps. It is never a set amount. Any help would be greatly appreciated.

VBA Template-Sample.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZ
1TabNamePlanNmPlanAliasPlanDescriptionTESTCRITERIA1CRITERIA2CRITERIA3TEST CASEAliasDescriptionSTEPSTEP 01System/ApplicationRole (if applicable)InstructionsExpected OutcomesData to CollectScreen Capture?Attachment?RequirementsSTEP 02System/ApplicationRole (if applicable)InstructionsExpected OutcomesData to CollectScreen Capture?Attachment?RequirementsSTEP 03System/ApplicationRole (if applicable)InstructionsExpected OutcomesData to CollectScreen Capture?Attachment?RequirementsSTEP 04System/ApplicationRole (if applicable)InstructionsExpected OutcomesData to CollectScreen Capture?Attachment?Requirements
2BD Fx-1Microbiology BD Fx-1MIC-BDF1CCV3 Microbiology BD Fx-1AV-Culture, Mycobacteria, Blood-Final AV 11Culture, Mycobacteria, Blood BTEC1 Method [123111] Final Auto VerificationAVFinal auto verification in Beaker for BTEC1 Method [123111]-Culture, Mycobacteria, BloodFinal Verification: Lab MC Mycobacteria Blood Final AV [755887]Spec IDX      
3BD Fx-1Microbiology BD Fx-1MIC-BDF1CCV3 Microbiology BD Fx-1AV-Culture, Mycobacteria, Blood-Final AV 22Culture, Mycobacteria, Blood BTEC1 Method [123111] Final Auto VerificationAVFinal auto verification in Beaker for BTEC1 Method [123111]-Culture, Mycobacteria, BloodFinal Verification: Lab MC Mycobacteria Blood Final AV [755887]Spec IDXLowLow Positive QCResults appear as expectedSpec IDX
4BD Fx-1Microbiology BD Fx-1MIC-BDF1CCV3 Microbiology BD Fx-1AV-Culture, Mycobacteria, Blood-Final AV 33Culture, Mycobacteria, Blood BTEC1 Method [123111] Final Auto VerificationAVFinal auto verification in Beaker for BTEC1 Method [123111]-Culture, Mycobacteria, BloodFinal Verification: Lab MC Mycobacteria Blood Final AV [755887]Spec IDXLowLow Positive QCResults appear as expectedSpec IDXNegativeRun Negative QCResults appear as expectedSpec IDX
5BD Fx-1Microbiology BD Fx-1MIC-BDF1CCV3 Microbiology BD Fx-1AV-Culture, Mycobacteria, Blood-Final AV 44Culture, Mycobacteria, Blood BTEC1 Method [123111] Final Auto VerificationAVFinal auto verification in Beaker for BTEC1 Method [123111]-Culture, Mycobacteria, BloodFinal Verification: Lab MC Mycobacteria Blood Final AV [755887]Spec IDX
6BD Fx-2Microbiology BD Fx-2MIC-BDF2CCV3 Microbiology BD Fx-2Blood culture 11Range and AMR validation of Blood cultureProcessRun both positive and negative specimens Receive and process specimen Confirm label readability Load the bottles Check the negative updates Update the positive (refer to BLC under LabPro)Accepts and transmit results to Beaker if meeting criteria Results translate as expectedSpec IDX      
7BD Fx-2Microbiology BD Fx-2MIC-BDF2CCV3 Microbiology BD Fx-2Blood culture 22Range and AMR validation of Blood cultureProcessRun both positive and negative specimens Receive and process specimen Confirm label readability Load the bottles Check the negative updates Update the positive (refer to BLC under LabPro)Accepts and transmit results to Beaker if meeting criteria Results translate as expectedSpec IDX
8BD Fx-2Microbiology BD Fx-2MIC-BDF2CCV3 Microbiology BD Fx-2Blood culture 33Range and AMR validation of Blood cultureProcessRun both positive and negative specimens Receive and process specimen Confirm label readability Load the bottles Check the negative updates Update the positive (refer to BLC under LabPro)Accepts and transmit results to Beaker if meeting criteria Results translate as expectedSpec IDX
9BD Fx-2Microbiology BD Fx-2MIC-BDF2CCV3 Microbiology BD Fx-2Blood culture 44Range and AMR validation of Blood cultureProcessRun both positive and negative specimens Receive and process specimen Confirm label readability Load the bottles Check the negative updates Update the positive (refer to BLC under LabPro)Accepts and transmit results to Beaker if meeting criteria Results translate as expectedSpec IDX
10DiaSorin1Microbiology DiaSorin1MIC-DSN1CCV3 Microbiology DiaSorin1QC -Adenovirus 11High Positive, Low Positive and Negative DiaSorin1 QCHighRun High Positive QCResults appear as expectedSpec IDXLowLow Positive QCResults appear as expectedSpec IDXNegativeRun Negative QCResults appear as expectedSpec IDX    
11DiaSorin1Microbiology DiaSorin1MIC-DSN1CCV3 Microbiology DiaSorin1QC -Adenovirus 22High Positive, Low Positive and Negative DiaSorin1 QCHighRun High Positive QCResults appear as expectedSpec IDXLowLow Positive QCResults appear as expectedSpec IDX
12DiaSorin1Microbiology DiaSorin1MIC-DSN1CCV3 Microbiology DiaSorin1QC -Adenovirus 33High Positive, Low Positive and Negative DiaSorin1 QCHighRun High Positive QCResults appear as expectedSpec IDXLowLow Positive QCResults appear as expectedSpec IDXNegativeRun Negative QCResults appear as expectedSpec IDX
13DiaSorin1Microbiology DiaSorin1MIC-DSN1CCV3 Microbiology DiaSorin1QC -Adenovirus 44High Positive, Low Positive and Negative DiaSorin1 QCHighRun High Positive QCResults appear as expectedSpec IDXLowLow Positive QCResults appear as expectedSpec IDXNegativeRun Negative QCResults appear as expectedSpec IDX
14DiaSorin2Microbiology DiaSorin2MIC-DSN2CCV3 Microbiology DiaSorin2QC -BK 11High Positive, Low Positive and Negative DiaSorin2 QCHighRun High Positive QCResults appear as expectedSpec IDX
15DiaSorin2Microbiology DiaSorin2MIC-DSN2CCV3 Microbiology DiaSorin2QC -BK 22High Positive, Low Positive and Negative DiaSorin2 QCHighRun High Positive QCResults appear as expectedSpec IDXLowLow Positive QCResults appear as expectedSpec IDXNegativeRun Negative QCResults appear as expectedSpec IDXOKLISRun OK QCResults appear as expectedSpec IDXX
16DiaSorin2Microbiology DiaSorin2MIC-DSN2CCV3 Microbiology DiaSorin2QC -BK 33High Positive, Low Positive and Negative DiaSorin2 QCHighRun High Positive QCResults appear as expectedSpec IDXLowLow Positive QCResults appear as expectedSpec IDX
17DiaSorin2Microbiology DiaSorin2MIC-DSN2CCV3 Microbiology DiaSorin2QC -BK 44High Positive, Low Positive and Negative DiaSorin2 QCHighRun High Positive QCResults appear as expectedSpec IDXLowLow Positive QCResults appear as expectedSpec IDXNegativeRun Negative QCResults appear as expectedSpec IDXOKLISRun OK QCResults appear as expectedSpec IDXX
18DiaSorin3Microbiology DiaSorin3MIC-DSN3CCV3 Microbiology DiaSorin3AV-BK Virus PCR Blood-Prevented AV 11BK Virus PCR Blood Diasorin 3 [123105] Auto Verification PreventedAVPrevented auto verification in Beaker for Diasorin 3 [123105]-BK Virus PCR BloodTest Auto Verification Prevented (Rule: MM Molecular Micro Prevent Final AV Rule [753520])Spec IDX          
19DiaSorin3Microbiology DiaSorin3MIC-DSN3CCV3 Microbiology DiaSorin3AV-BK Virus PCR Blood-Prevented AV 22BK Virus PCR Blood Diasorin 3 [123105] Auto Verification PreventedAVPrevented auto verification in Beaker for Diasorin 3 [123105]-BK Virus PCR BloodTest Auto Verification Prevented (Rule: MM Molecular Micro Prevent Final AV Rule [753520])Spec IDX
20DiaSorin3Microbiology DiaSorin3MIC-DSN3CCV3 Microbiology DiaSorin3AV-BK Virus PCR Blood-Prevented AV 33BK Virus PCR Blood Diasorin 3 [123105] Auto Verification PreventedAVPrevented auto verification in Beaker for Diasorin 3 [123105]-BK Virus PCR BloodTest Auto Verification Prevented (Rule: MM Molecular Micro Prevent Final AV Rule [753520])Spec IDXLowLow Positive QCResults appear as expectedSpec IDXNegativeRun Negative QCResults appear as expectedSpec IDXOKLISRun OK QCResults appear as expectedSpec IDXX
21DiaSorin3Microbiology DiaSorin3MIC-DSN3CCV3 Microbiology DiaSorin3AV-BK Virus PCR Blood-Prevented AV 44BK Virus PCR Blood Diasorin 3 [123105] Auto Verification PreventedAVPrevented auto verification in Beaker for Diasorin 3 [123105]-BK Virus PCR BloodTest Auto Verification Prevented (Rule: MM Molecular Micro Prevent Final AV Rule [753520])Spec IDX
22DiaSorin4Microbiology DiaSorin4MIC-DSN4CCV3 Microbiology DiaSorin4EBV 11Range and AMR validation of EBVProcessReceive and process specimen Confirm label readability Load and run specimen Review and upload results to DI Review results in BeakerAccepts and transmit results to Beaker if meeting criteria Results translate as expectedSpec IDX          
23DiaSorin4Microbiology DiaSorin4MIC-DSN4CCV3 Microbiology DiaSorin4EBV 22Range and AMR validation of EBVProcessReceive and process specimen Confirm label readability Load and run specimen Review and upload results to DI Review results in BeakerAccepts and transmit results to Beaker if meeting criteria Results translate as expectedSpec IDX            
24DiaSorin4Microbiology DiaSorin4MIC-DSN4CCV3 Microbiology DiaSorin4EBV 33Range and AMR validation of EBVProcessReceive and process specimen Confirm label readability Load and run specimen Review and upload results to DI Review results in BeakerAccepts and transmit results to Beaker if meeting criteria Results translate as expectedSpec IDXLowLow Positive QCResults appear as expectedSpec IDX        
25DiaSorin4Microbiology DiaSorin4MIC-DSN4CCV3 Microbiology DiaSorin4EBV 44Range and AMR validation of EBVProcessReceive and process specimen Confirm label readability Load and run specimen Review and upload results to DI Review results in BeakerAccepts and transmit results to Beaker if meeting criteria Results translate as expectedSpec IDX            
Working


VBA Template-Sample.xlsx
ABCDEFGHI
1
2TEST PLAN01-TEMPLATE
3AliasALIAS
4Description01-TEMPLATE Validation Testing
5
6TEST CASEMy Sample Testcase
7Alias000
8DescriptionDescription
9STEP
10STEP 01Step
11System/ApplicationWPE CP
12Role (if applicable)Pathologist
13InstructionsInstructions
14Expected OutcomesOutcomes
15Data to CollectData
16Screen Capture?X
17Attachment?X
18RequirementsCP1.A.3|Receive Order Comms from ICE
19
20STEP 02
21System/Application
22Role (if applicable)
23Instructions
24Expected Outcomes
25Data to Collect
26Screen Capture?
27Attachment?
28Requirements
29
30STEP 03
31System/Application
32Role (if applicable)
33Instructions
34Expected Outcomes
35Data to Collect
36Screen Capture?
37Attachment?
38Requirements
39
40STEP 04
41System/Application
42Role (if applicable)
43Instructions
44Expected Outcomes
45Data to Collect
46Screen Capture?
47Attachment?
48Requirements
49
50STEP 05
51System/Application
52Role (if applicable)
53Instructions
54Expected Outcomes
55Data to Collect
56Screen Capture?
57Attachment?
58Requirements
59
60STEP 06
61System/Application
62Role (if applicable)
63Instructions
64Expected Outcomes
65Data to Collect
66Screen Capture?
67Attachment?
68Requirements
69
Template
 

Attachments

  • Working Overview.png
    Working Overview.png
    92.8 KB · Views: 5
  • Working Close-Up.png
    Working Close-Up.png
    155.3 KB · Views: 5
  • Empty Template.png
    Empty Template.png
    44.5 KB · Views: 5
  • Completed Sample.png
    Completed Sample.png
    62.5 KB · Views: 5

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,224,813
Messages
6,181,107
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top