Duplicate Sheet When Complete

Pestomania

Active Member
Joined
May 30, 2018
Messages
341
Office Version
  1. 365
Platform
  1. Windows
Hello!!

I have the below sheet that I am using to "trigger" actions and I would like some help.

Trigger: When button1 is clicked, create a new sheet where Business_Process_List[Link to Sheet] = "" (is empty) & Business_Process_List[Business Processes] <> "" (contains a value)

Action 1: Make a copy of sheet named "Template" (this sheet is hidden at all times)
Action 2: Get value from Business_Process_List[New Sheet Name] (which will be hidden) & name new sheet with this name
Action 3: Get value from Business_Process_List[Identifier] (which may be hidden) & place it in the new sheet created under cell A2 (which will be hidden)
Action 4: Input a "Link to Sheet (cell B1)" in Business_Process_List[Link to Sheet]
Action 5: Lock the Business_Process_List[Business Processes] value that was just created (I don't want it to be edited once someone types it in and the new sheet has been created).

Loop this action until all Triggers are completed and no further Business Processes exist without a link.

If you have any efficiency recommendations, I am interested in them!

Here is my origin table:

Cell Formulas
RangeFormula
A2:A21A2=Dashboard!$B$2&" - BP"&ROW([@[Business Processes]])-1
B2:B21B2=IF(LEN([@Identifier] & " ("& [@[Business Processes]]&")")>31,LEFT([@Identifier] & " ("& [@[Business Processes]]&")",30)&")",[@Identifier] & " ("& [@[Business Processes]]&")")
Named Ranges
NameRefers ToCells
Business_Process_Identifier_List=Business_Process_List[Identifier]B2
 
I was able to work out a script to create the duplicate worksheet, which is below. How can I design the trigger to work properly?

VBA Code:
Sub Duplicate_Business_Process()

Dim New_Sheet_Name As String
Dim Business_Process_Identifier As String
Dim Trigger_Row As String
Dim new_Business_Process As Worksheet


New_Sheet_Name = Worksheets("Input Business Processes Tables").Range("B2").Value
Business_Process_Identifier = Worksheets("Input Business Processes Tables").Range("A2").Value

Sheets("Template").Copy Before:=Sheets(4)
Sheets(4).Name = New_Sheet_Name
Sheets(New_Sheet_Name).Range("A2") = Business_Process_Identifier

Set new_Business_Process = ActiveSheet

Worksheets("Input Business Processes Tables").Activate
ActiveSheet.Range("E2").Select
    Selection.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
        "'" & new_Business_Process.Name & "'" & "!B2", TextToDisplay:= _
         New_Sheet_Name

MsgBox New_Sheet_Name

End Sub
 
Upvote 0

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