Save sheet as a new values only workbook to a specified location

Joined
Jan 14, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi Experts,

I am trying to piece together a VBA code for a command button to:

1) save a copy of a sheet into a new workbook (source sheet currently located in a collaborative workbook which I would like to preserve)
2) save it as a values only copy into a specified folder (take away the formatting)
3) name the new workbook as a combination 3 other cells on the source sheet [a5 & b5 & c5]

I'd greatly appreciate the help.

Thank you!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You will need to replase "ThisWorkbook.Path" in the code with the specific folder path that you want to save the file to. When starting a thread where a file needs to be saved to other than the default directory, you should spell out what that directory path is in the original post to save time and effort of having to do it after the fact.

VBA Code:
Sub t()
Dim sh As Worksheet, wb As Workbook, specFolder As String
specFolder = ThisWorkbook.Path 'Change to path for specific folder
Set sh = ActiveSheet
Set wb = Workbooks.Add
sh.UsedRange.Copy
wb.Sheets(1).Range("A1").PasteSpecial xlPasteValues
wb.SaveAs specFolder & "\" & sh.Range("A5") & sh.Range("B5") & sh.Range("C5")
wb.Close False
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,424
Messages
6,119,407
Members
448,894
Latest member
spenstar

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