Create Copy of Worksheet and have Cell c2 = tab name of original tab used to create new tab

pjn560

New Member
Joined
Jul 29, 2015
Messages
16
I need to create a new tab from the left most tab in workbook and have it placed to the left of the tab I am copying. Then in new tab have cell C2 = the name of the tab I used to create the new tab. A formula would be best but using code will work.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
a formula to create a new tab... dont think so but you can use vba...

name = Range("C2").Value
Set s = Sheets.Add Before:=Sheets(1)
s.Name = name

what's your question?
 
Upvote 0
Perhaps.
Code:
Sheets(1).Copy Before:=Sheets(1)

Sheets(1).Range("C2").Value = Sheets(2).Name
 
Upvote 0
Solution
In my spreadsheet I start with tab "Feb 2018", I need to create a new tab (will be renamed "Mar 2018") from this tab and need Cell C2 to be Feb 2018. Next month I will create new tab from the "Mar 2018" tab and rename it "Apr 2018" and need Cell C2 to be Mar 2018. The new tab will always be to the left of the tab used to create the new one.
 
Last edited:
Upvote 0
The code I posted will copy the leftmost sheet and place the copy in the leftmost position, it will then put the name of the sheet that was copied into C2 on the new sheet.
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,538
Members
449,316
Latest member
sravya

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