How do I save the worksheet into a new workbook with the file name referencing from Sheet1 C3 via VBA?

Starkers

New Member
Joined
Oct 26, 2021
Messages
14
Office Version
  1. 365
Platform
  1. Windows
How do I save the worksheet into a new workbook with the file name referencing from Sheet1 C3?

Currently this is the vba code that I am using right now.

VBA Code:
Sub Billing_Milestone()

Worksheets("Billing Milestone").Copy
    With ActiveWorkbook
       .SaveAs Filename:= "C:\Users\Desktop" & "Billing Milestone", FileFormat:=xlOpenXMLWorkbook
        .Close savechanges:=False
    End With
End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Do you want to use C3 in the Billing Milestones sheet, for the file name?
 
Upvote 0
How do I save the worksheet into a new workbook with the file name referencing from Sheet1 C3?

Currently this is the vba code that I am using right now.

VBA Code:
Sub Billing_Milestone()

Worksheets("Billing Milestone").Copy
    With ActiveWorkbook
       .SaveAs Filename:= "C:\Users\Desktop" & "Billing Milestone", FileFormat:=xlOpenXMLWorkbook
        .Close savechanges:=False
    End With
End Sub
Do you want to use C3 in the Billing Milestones sheet, for the file name?
The filename should be values in C3 (from Sheet1) & “Billing Milestone”
 
Upvote 0
Ok, how about
VBA Code:
Sub Billing_Milestone()
   Dim Fname As String
   Fname = Sheets("Sheet1").Range("C3").Text
Worksheets("Billing Milestone").Copy
    With ActiveWorkbook
       .SaveAs Filename:="C:\Users\Desktop\" & Fname & " Billing Milestone", FileFormat:=xlOpenXMLWorkbook
        .Close savechanges:=False
    End With
End Sub
 
Upvote 0
Ok, how about
VBA Code:
Sub Billing_Milestone()
   Dim Fname As String
   Fname = Sheets("Sheet1").Range("C3").Text
Worksheets("Billing Milestone").Copy
    With ActiveWorkbook
       .SaveAs Filename:="C:\Users\Desktop\" & Fname & " Billing Milestone", FileFormat:=xlOpenXMLWorkbook
        .Close savechanges:=False
    End With
End Sub
Wow, it works. This is nice, thanks for the assist!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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