replacing formulas with values after saving

AwesomeSteph

Board Regular
Joined
Aug 18, 2017
Messages
80
I have been trying to simplify my code with no luck. What I am using works fine but to adopt the same code for more workbooks I would like it to be easier. Currently I am having the VBA evaluate some cells but I would like to have it do the same thing for the whole worksheet and I am not having any luck. Also I need to change the location of the new worksheet to save to a different folder not the one that the current workbook lives in. (This is a boilerplate with multiple forms and I need certain forms to be saved into different folders depending on what project the user is working on).

Code:
Set wbThis = ThisWorkbook
        strFilename = wbThis.Path & "/" & ws.Name
        ws.Copy
        Set wbNew = ActiveWorkbook
        
        If ws.Name = "worksheetname" Then
            Range("B4").Value = Evaluate("B4")
            Range("E4").Value = Evaluate("E4")
            Range("I4").Value = Evaluate("I4")
            Range("B5").Value = Evaluate("B5")
            Range("E5").Value = Evaluate("E5")
            Range("I5").Value = Evaluate("I5")
            Range("C6").Value = Evaluate("C6")
            Range("I6").Value = Evaluate("I6")
            Range("C7").Value = Evaluate("C7")
            Range("I7").Value = Evaluate("I7")
            Range("I10").Value = Evaluate("I10")
            Range("I11").Value = Evaluate("I11")
            Range("C14").Value = Evaluate("C14")
            Range("F14").Value = Evaluate("F14")
            Range("C15").Value = Evaluate("C15")
            Range("F15").Value = Evaluate("F15")
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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