Need one more bit of VBA to save wksht as values in new wkbk

DaynaBarnes

New Member
Joined
Jul 22, 2013
Messages
3
Hi all--I have the need to save only the values from one sheet of a workbook, as .csv in a new workbook that is named according to the value in cell A2. The sheet is populated according to formulas. I have a nice, simple VBA doing everything right...except it copies the formulas over, and the end users won't have access to the generator. Could someone please help me figure out the simplest way to get ONLY the values into my new file?

Here's the existing code:

Sub CopyFile2()
'
' CopyFile Macro
'


'
Dim FileName As String
Dim Path As String
Application.DisplayAlerts = False
FileName = Range("A2").Value

Sheets("CSVfile").Select
Sheets("CSVfile").Copy
Sheets("CSVfile").Select
ChDir "P:"
ActiveWorkbook.SaveAs FileName:="P:" & FileName, FileFormat:=xlCSV, _
CreateBackup:=False


End Sub
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Now I don't understand why, but after I closed the file and reopened it, Voila! no more formulas. Guess I answered my own question.:confused:

Hi all--I have the need to save only the values from one sheet of a workbook, as .csv in a new workbook that is named according to the value in cell A2. The sheet is populated according to formulas. I have a nice, simple VBA doing everything right...except it copies the formulas over, and the end users won't have access to the generator. Could someone please help me figure out the simplest way to get ONLY the values into my new file?

Here's the existing code:

Sub CopyFile2()
'
' CopyFile Macro
'


'
Dim FileName As String
Dim Path As String
Application.DisplayAlerts = False
FileName = Range("A2").Value

Sheets("CSVfile").Select
Sheets("CSVfile").Copy
Sheets("CSVfile").Select
ChDir "P:"
ActiveWorkbook.SaveAs FileName:="P:" & FileName, FileFormat:=xlCSV, _
CreateBackup:=False


End Sub
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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