Save Active Sheet with Custom Text followed by Active Tab Name

jehuh

New Member
Joined
Dec 9, 2021
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
Hello All,
I'm looking for some assistance with a macro that will do the following:

1. Take the active tab, DELETE the contents of Columns J thru K (link and macro button)
2. Save the tab as it's own file in the local folder where the "master file" currently lives that the file was copied from
3. Save the new file as the tab name, preceded by the contents of cell D5 (example. Project Apple - Apple Sales)

Screenshot of my excel sheet and code below. I appreciate the help!!

Sub SaveActiveSheet()

Dim xPath As String
Dim xWs As String

xPath = Application.ActiveWorkbook.Path


Application.ScreenUpdating = False
Application.DisplayAlerts = False

With ActiveSheet
ActiveSheet.Copy
Application.ActiveWorkbook.SaveAs filename:=xPath & "\" & ActiveSheet.Name & " " & Range("N2").Value & " " & Range("N5").Value & ".xlsx"
Application.ActiveWorkbook.Close False
End With

Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub


1690825348231.png
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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