Macro to copy sheet in New Workbook and name it by cell value derivative in a specified folder

Status
Not open for further replies.

Antonescu

New Member
Joined
Feb 19, 2021
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Hello,

Sorry if this was asked before, but I haven't found this specific set of command, nor managed to adapt it. So here goes:
I want to:
1. Copy a sheet intro a new workbook, then
2. Save that file in a specific folder
3. With a name that contains a fixed part "Nume", a cell value and another fixed part "Prenume"

I have the code below and basically it just the 3rd point I'm having trouble with. In the code, I want the bolded A1, to be the actual value in cell A1.

Sub Fisier()
'
' Fisier Macro
'

'
Sheets("extract").Select
Sheets("extract").Copy
ChDir "C:\Users\AntonG\Desktop"
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\AntonG\Desktop\Nume A1 Prenume.xlsx", FileFormat:=xlOpenXMLWorkbook _
, CreateBackup:=False
Application.WindowState = xlNormal
End Sub

I'd be so grateful for an idea.
Thank you!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
How about
VBA Code:
Sub Fisier()
'
' Fisier Macro
'

'
Sheets("extract").Copy
ChDir "C:\Users\AntonG\Desktop"
ActiveWorkbook.SaveAs FileName:= _
"C:\Users\AntonG\Desktop\Nume " & Range("A1").Value & " Prenume.xlsx", FileFormat:=xlOpenXMLWorkbook _
, CreateBackup:=False
Application.WindowState = xlNormal
End Sub
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,063
Messages
6,122,930
Members
449,094
Latest member
teemeren

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