Macro to paste values to new workbook

Billiam75

New Member
Joined
Nov 10, 2023
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Hello,

I'm not sure of the correct terminology for what I'm looking for.

I have this macro:

VBA Code:
Sub SaveScheduleForm()
'Saves filename
Dim newFile As String, fName As String, fName2 As String
' Don't use "/" in date, invalid syntax
FPath = "H:\Schedules"
fName = Range("Sheet2!B1")
fName2 = Range("Sheet2!B3")
'Change the date format to whatever you'd like, but make sure it's in quotes
newFile = fName & " - " & fName2
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:=FPath & "\" & newFile
End Sub

It works great for what I need it to do, but the sheet has a lot of formulas in it that I then have to copy and paste values over.

Is there a way for it to just copy the values of the active sheet to the new file?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
See if this works for you.

VBA Code:
Sub SaveScheduleForm()
    'Saves filename
    Dim newFile As String, fName As String, fName2 As String, FPath As String
    
    ' Don't use "/" in date, invalid syntax
    FPath = "H:\Schedules"
    fName = Range("Sheet2!B1")
    fName2 = Range("Sheet2!B3")

    'Change the date format to whatever you'd like, but make sure it's in quotes
    newFile = fName & " - " & fName2
    ActiveSheet.Copy                                                'copy worksheet to new workbook
    ActiveSheet.UsedRange.Value = ActiveSheet.UsedRange.Value       'convert formulas to value in the new workbook
    ActiveWorkbook.SaveAs Filename:=FPath & "\" & newFile           'save new file
    ActiveWorkbook.Close False                                      'close new file
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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