Create New Sheet with Specific Name Based on Variable Cell

SBExcel123

New Member
Joined
Sep 11, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have an excel file that has 3 main sheets.
The first sheet is a Table of Contents for different line items (Line Item List).
The second sheet is a Summary (0000_Summary). Each Line Item will have its own summary sheet.
The third sheet is a Form (0000-01). Each Line Item can have several forms as new forms are needed for each line item.

My goal would be to create a new sheet, named with the next available Source Number for the Line Item once a sheet has been completed for the current Source Number. For example, once I have completed a form for 0000-01, I would like to have some VBA button (on the Summary sheet) that allows me to copy 0000-01 (Form sheet), clear it, and rename it to 0000-02. I'd also like to create a hyperlink to 0000-02 on the summary sheet once it's been created. Once 0000-02 is complete, I'd like to copy it, clear it, name it 0000-03, and hyperlink it. And so on and so forth.

Test%20Project (version 1).xlsb
ABCDEFGHIJK
1Line ItemCategoryItem NumberItem DescriptionUnitsBid QuantityTo-Date QuantityRemaining QuantitySheet NameReference Cell
200000100100-00000TEST ITEM 1EACH10050500000_SummaryO2
300050200200-00000TEST ITEM 2EACH200#REF!#REF!0005_SummaryO2
400100300300-00000TEST ITEM 3EACH300#REF!#REF!0010_SummaryO2
Line Item List
Cell Formulas
RangeFormula
G2:G4G2=INDIRECT("'"&A2&"_Summary'!"&K2)
H2:H4H2=F2-G2


Test%20Project (version 1).xlsb
ABCDEFGHIJKLMNO
10000_SummaryLINE ITEM0000BID QUANTITY100
2CATEGORY NUMBER0100TO-DATE QUANTITY50
3ITEM NUMBER100-00000REMAINING QUANTITY50
4DESCRIPTIONTEST ITEM 1
5UNITSEACH
6
7SOURCE NUMBERDATE COMPLETEDQUANTITYESTIMATESTATUS
800000000-01'0000-01'000001201-000000000 | 201-00000TEST ITEM 1EACH0000-0112/12/2012501CLOSED - USE NEXT AVAILABLE SOURCE NUMBER
900000000-02'0000-02'000002201-000000000 | 201-00000TEST ITEM 1EACH0000-02   OPEN - CREATE NEW FORM
1000000000-03'0000-03'000003201-000000000 | 201-00000TEST ITEM 1EACH     
1100000000-04'0000-04'000004201-000000000 | 201-00000TEST ITEM 1EACH     
1200000000-05'0000-05'000005201-000000000 | 201-00000TEST ITEM 1EACH     
1300000000-06'0000-06'000006201-000000000 | 201-00000TEST ITEM 1EACH     
1400000000-07'0000-07'000007201-000000000 | 201-00000TEST ITEM 1EACH     
1500000000-08'0000-08'000008201-000000000 | 201-00000TEST ITEM 1EACH     
1600000000-09'0000-09'000009201-000000000 | 201-00000TEST ITEM 1EACH     
1700000000-10'0000-10'000010201-000000000 | 201-00000TEST ITEM 1EACH     
1800000000-11'0000-11'000011201-000000000 | 201-00000TEST ITEM 1EACH     
1900000000-12'0000-12'000012201-000000000 | 201-00000TEST ITEM 1EACH     
2000000000-13'0000-13'000013201-000010000 | 201-00001TEST ITEM 1EACH     
2100000000-14'0000-14'000014201-000020000 | 201-00002TEST ITEM 1EACH     
2200000000-15'0000-15'000015201-000030000 | 201-00003TEST ITEM 1EACH     
2300000000-16'0000-16'000016201-000040000 | 201-00004TEST ITEM 1EACH     
2400000000-17'0000-17'000017201-000050000 | 201-00005TEST ITEM 1EACH     
2500000000-18'0000-18'000018201-000060000 | 201-00006TEST ITEM 1EACH     
2600000000-19'0000-19'000019201-000070000 | 201-00007TEST ITEM 1EACH     
2700000000-20'0000-20'000020201-000080000 | 201-00008TEST ITEM 1EACH     
2800000000-21'0000-21'000021201-000090000 | 201-00009TEST ITEM 1EACH     
2900000000-22'0000-22'000022201-000100000 | 201-00010TEST ITEM 1EACH     
3000000000-23'0000-23'000023201-000110000 | 201-00011TEST ITEM 1EACH     
3100000000-24'0000-24'000024201-000120000 | 201-00012TEST ITEM 1EACH     
3200000000-25'0000-25'000025201-000130000 | 201-00013TEST ITEM 1EACH     
3300000000-26'0000-26'000026201-000140000 | 201-00014TEST ITEM 1EACH     
3400000000-27'0000-27'000027201-000150000 | 201-00015TEST ITEM 1EACH     
3500000000-28'0000-28'000028201-000160000 | 201-00016TEST ITEM 1EACH     
3600000000-29'0000-29'000029201-000170000 | 201-00017TEST ITEM 1EACH     
3700000000-30'0000-30'000030201-000180000 | 201-00018TEST ITEM 1EACH     
3800000000-31'0000-31'000031201-000190000 | 201-00019TEST ITEM 1EACH     
3900000000-32'0000-32'000032201-000200000 | 201-00020TEST ITEM 1EACH     
4000000000-33'0000-33'000033201-000210000 | 201-00021TEST ITEM 1EACH     
4100000000-34'0000-34'000034201-000220000 | 201-00022TEST ITEM 1EACH     
4200000000-35'0000-35'000035201-000230000 | 201-00023TEST ITEM 1EACH     
4300000000-36'0000-36'000036201-000240000 | 201-00024TEST ITEM 1EACH     
4400000000-37'0000-37'000037201-000250000 | 201-00025TEST ITEM 1EACH     
4500000000-38'0000-38'000038201-000260000 | 201-00026TEST ITEM 1EACH     
4600000000-39'0000-39'000039201-000270000 | 201-00027TEST ITEM 1EACH     
4700000000-40'0000-40'000040201-000280000 | 201-00028TEST ITEM 1EACH     
4800000000-41'0000-41'000041201-000290000 | 201-00029TEST ITEM 1EACH     
4900000000-42'0000-42'000042201-000300000 | 201-00030TEST ITEM 1EACH     
5000000000-43'0000-43'000043201-000310000 | 201-00031TEST ITEM 1EACH     
5100000000-44'0000-44'000044201-000320000 | 201-00032TEST ITEM 1EACH     
5200000000-45'0000-45'000045201-000330000 | 201-00033TEST ITEM 1EACH     
5300000000-46'0000-46'000046201-000340000 | 201-00034TEST ITEM 1EACH     
5400000000-47'0000-47'000047201-000350000 | 201-00035TEST ITEM 1EACH     
5500000000-48'0000-48'000048201-000360000 | 201-00036TEST ITEM 1EACH     
0000_Summary
Cell Formulas
RangeFormula
H1H1=MID(CELL("filename",D1),FIND("]",CELL("filename",D1))+1,255)
O1O1=VLOOKUP(K1,'Line Item List'!A1:H4,6,FALSE)
O2O2=SUM(L8:L55)
O3O3=O1-O2
K1K1=LEFT(H1,4)
K2K2=VLOOKUP(K1,'Line Item List'!A1:H4,2,FALSE)
K3K3=VLOOKUP(K1,'Line Item List'!A1:H4,3,FALSE)
K4K4=VLOOKUP(K1,'Line Item List'!A1:H4,4,FALSE)
K5K5=VLOOKUP(K1,'Line Item List'!A1:H4,5,FALSE)
A8:A55A8=LEFT($H$1,4)
B8:B55B8=A8&"-"&E8
C8:C55C8="'"&B8&"'"
D8:D55D8=$K$1
G8:G55G8=D8&" | "&F8
H8:H55H8=$K$4
I8:I55I8=$K$5
J8J8=B8
K8:K55K8=IFERROR(IF(J8="","",IF(INDIRECT(C8&"!$L$5")="","",INDIRECT(C8&"!$L$5"))),"")
L8:L55L8=IFERROR(IF(J8="","",IF(INDIRECT(C8&"!$K$50")="","",INDIRECT(C8&"!$K$50"))),"")
M8:M55M8=IFERROR(IF(J8="","",IF(INDIRECT(C8&"!$D$41")="","",INDIRECT(C8&"!$D$41"))),"")
N8N8=IFERROR(IF(J8="","",IF(K8="","OPEN - USE CURRENT SOURCE NUMBER","CLOSED - USE NEXT AVAILABLE SOURCE NUMBER")),"")
J9:J55J9=IF(N8="","",IF(N8="OPEN - CREATE NEW FORM","",B9))
N9:N55N9=IFERROR(IF(J9="","",IF(K9="","OPEN - CREATE NEW FORM","CLOSED - USE NEXT AVAILABLE SOURCE NUMBER")),"")
Named Ranges
NameRefers ToCells
'Line Item List'!_FilterDatabase='Line Item List'!$A$1:$H$21K2:K5, O1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
N8:N55Cell Value="CLOSED - USE NEXT AVAILABLE SOURCE NUMBER"textNO
N8:N55Cell Value="OPEN - CREATE NEW FORM"textNO


Test%20Project (version 1).xlsb
ABCDEFGHIJKLMN
1COLORADO DEPARTMENT OF TRANSPORTATION
2INSPECTOR'S PROGRESS REPORT
3
4Project No.:Project Code (SA#):Date:
512/12/2012
6No. of Workers:Equipment:
7
8
9Location, Comments, and Supporting Calculations:
10Category:0100
11This report is written to document payment for item:TEST ITEM 1
12
13Contractor:
14Description:
15
16
17
18
19
20
21
22
23
24Comments:
25
26
27
28
29References:
30Calculations:
31
32
33
34
35
36
37Quantity Completed To-Date:EACH
38Less Quantity Previously Paid:EACH
39Pay Total (This Report):EACH
40
41Current Estimate No.:1PAYEACH
42
43
44InterimCalculated By:Measured By:
45
46FinalPosted By:Checked By:
47
48
49Reference No.:Item No.:Item DescriptionQuantityUnit
5000000000TEST ITEM 150EACH
51
52
53The item(s) and material(s) listed above were inspected and found to conform reasonably with the contract plans and specifications, except as noted.
54Signed By:TitleNo.
550000-01
56
0000-01
Cell Formulas
RangeFormula
G10G10=VLOOKUP(B50,'Line Item List'!A1:H4,2,FALSE)
G11G11=VLOOKUP(B50,'Line Item List'!A1:H4,4,FALSE)
L37L37=L50
L38L38=L50
L39L39=L50
L41L41=L50
B50B50=LEFT(L55,4)
D50D50=VLOOKUP(B50,'Line Item List'!A1:H4,1,FALSE)
F50F50=VLOOKUP(B50,'Line Item List'!A1:H4,4,FALSE)
L50L50=VLOOKUP(B50,'Line Item List'!A1:H4,5,FALSE)
L55L55=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,255)
Named Ranges
NameRefers ToCells
'Line Item List'!_FilterDatabase='Line Item List'!$A$1:$H$21G10:M11, D50:J50, L50:M50
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,221,390
Messages
6,159,588
Members
451,575
Latest member
Radha Krishna

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