Macro for exporting individual sheet to new workbook

markdwalls

New Member
Joined
May 15, 2018
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I was wondering if there is a way you could write a macro so that one sheet, when a button is pressed, could be exported to a new workbook with values only as the formulas within the sheet are linked to other sheets.
I was also wondering if i could automatically name the file depending on a certain cell e.g. Filename="X"&A1&"X"

I am not very good with macros so any help would be greatly appreciated.

Kind regards,

Mark
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
How about
VBA Code:
Sub markdwalls()
   Sheets("Test").Copy
   With ActiveWorkbook
      With .Sheets("Test").UsedRange
         .Value = .Value
      End With
      .SaveAs ThisWorkbook.Path & "\" & Range("A1").Value, 52
   End With
End Sub
Change sheet name to suit
 
Upvote 0
Thank you for your reply. This works quite well. Is there a way i can save it manually to a place of my choosing instead of it automatically saving?

Thanks in advance
 
Upvote 0
OK, how about
VBA Code:
Sub markdwalls()
   Dim FullPth As String
   
   Sheets("Test").Copy
   With ActiveWorkbook
      With .Sheets("Test").UsedRange
         .Value = .Value
         FullPth = Application.GetSaveAsFilename(.Range("A1").Value)
      End With
      .SaveAs FullPth & ".xlsm", 52
   End With
End Sub
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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