SaveCost Estimate with New Name vba

Katsimps

New Member
Joined
Jan 24, 2018
Messages
11
Hi

I have the following code which I found and it works by copying the active sheet and saving as a new file name, however I'd like to save the whole workbook as a new file name. I also don't know how to change the word Invoice to Cost Estimate? Any help much appreciated.

Sub NextInvoice()
Range("I1").Value = Range("I1").Value + 1
Range("B16:F30").ClearContents
Range("H16:H30").ClearContents

End Sub

Sub SaveInvoiceWithNewName()
Dim NewFN As Variant
' Copy Invoice to a New Workbook
ActiveSheet.Copy
NewFN = "C:\Temp\Cost_Estimate_" & Range("I1").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
NextInvoice
End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
try the following codes
Sub save_file()
Dim a As String
Cells(1, 1) = "=cell(""filename"")"
Cells(1, 2) = "=left(A1,find(""["",A1)-1)"
a = InputBox("Enter the new file name")
ActiveWorkbook.SaveCopyAs Cells(1, 2) & a & ".xlsm"
MsgBox "complete"
End Sub
ravi shankar
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,924
Members
452,366
Latest member
TePunaBloke

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