Question about Saving Tabs and stuff in VBA

Naebue

New Member
Joined
Jul 10, 2013
Messages
1
Hello everyone, I am a first time poster here, but a long time user of Excel. I have not needed to dabble in macros or VBA until recently, so I'm fairly new with them.

Using: Excel 2010

Prominent Cell:
H4 = Pay Period Ending Date, drop down list of dates through the PPE 12/6/2013

Current Tabs:
6.7 - 6.21 - 7.5 - 7.19

Question:
How would I copy the active tab, place it at the end of all tabs, change H4 to show current PPE Date and reference it as the name for the newly copied tab?

Example:
Lets say I did not create tab 7.19 yet
Active tab is 7.5, I want to copy the active tab and place it at the end of all the tabs (so the name of the new tab is 7.5(copy), change cell H4 to show current pay period ending date of 7.19, then rename 7.5(copy) to 7.19.

This is what I have currently, including clearing time entered in the cells that are being cleared.

ActiveWorkbook.CheckCompatibility = False
Sheets("7.5").Select
Sheets("7.5").Copy After:=Sheets(3)
Range("B13:C19").Select
Selection.ClearContents
Range("E13:F19").Select
Selection.ClearContents
Range("B23:C29").Select
Selection.ClearContents
Range("E23:F29").Select
Selection.ClearContents
Range("B13").Select
ActiveWorkbook.Save
End Sub

My thoughts with the above code is that it will always select sheet 7.5 and create 7.5(copy) after the 3rd sheet in the workbook.

I hope I've explained what I'm trying to do well enough.

I appreciate your help!
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,214,907
Messages
6,122,185
Members
449,071
Latest member
cdnMech

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