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

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
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,224,827
Messages
6,181,197
Members
453,022
Latest member
RobertV1609

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