VBA: Create and rename tabs based on user input

SkyeS

New Member
Joined
May 21, 2015
Messages
40
I have code so far that will copy and paste the tabs based on the number of instances I input. But I would like to add a feature to allow the user to input the names of these tabs without using multiple input boxes. I need the tab to say "Summary: ______" Where the ________ each time is going to have another number/letter reference such as XX-10. So the tabs should read "Summary: XX-10" And then maybe a second tab is "Summary: XX-57"

The way I have it set up so far is the user as all of coln A (except A1) to list those number methods (XX-10, YY-50, ect). The user then clicks a button to start the macro. A dialog box pops up saying "How many tests are there?" The user then inputs a number lets say 5. I would then want 5 summary tabs to be generated with the naming I described above.

Here is the code I have so far.

Code:
Private Sub AddTabs_Click()


    Set wBk = ActiveWorkbook
    Dim NumTabs As Variant


    NumTabs = InputBox("How many FGs are there?", "Add tabs", 1)


For i = 1 To NumTabs - 1
        With wBk
            Sheets("Summary").Select
            Sheets("Summary").Copy After:=Sheets(Sheets.Count)
        End With
     Next i
     
End Sub
Thank you for any help you can give me on this!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,213,533
Messages
6,114,179
Members
448,554
Latest member
Gleisner2

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