I would like to copy the active sheet (notwithstanding the name of the sheet) to a new WorkBook to be saved without a formula. A copy of the sheet to a new sheet is working according to VBA Copy a Worksheet to a New Sheet without Formulas with some additions to the code:
Public Sub CopySheetAndRename()
Dim newName As String
On Error Resume Next
newName = InputBox("Enter the name for the copied worksheet")
If newName <> "" Then
ActiveSheet.Copy After:=Worksheets(Sheets.Count)
On Error Resume Next
ActiveSheet.Name = newName
Worksheets(newName).UsedRange.Value = Worksheets(newName).UsedRange.Value
End If
End Sub
-- Then I tried to add the dialogbox Application.Dialogs(xlDialogSaveAs).Show before "end if" and change "ActiveSheet.Name" to "ThisWorkbook.ActiveSheet.Name" but it does not work. (Or at least it copies the sheet into a new workbook but does not transfer the values). Any ideas on how to run the code? Thank you in advance!
ActiveSheet.Copy After:=Worksheets(Sheets.Count)
doesn't copy a sheet into a new workbook though. – BigBen