Bembridge7
New Member
- Joined
- Oct 15, 2019
- Messages
- 2
Hi Guys
I am hoping someone can help me with this..So I am trying to create a copy of one worksheet and paste special values. I'd like to be able to choose a name for the worksheet and keep the worksheet within the existing workbook, moving the worksheet to the front. Apoligies if the format is not in line with requirements, this is my first post. I'm pretty sure this part is not correct for some reason - " Before:=ActiveWorkbook.Sheets(1)"
Here is my code:
Public Sub CopySheetToReport()
Dim newName As String
On Error Resume Next
newName = InputBox("Enter the name for the copied worksheet")
If newName <> "" Then
ActiveSheet.Copy.PasteSSpecial Paste:=xlPasteValues
Before:=ActiveWorkbook.Sheets(1)
On Error Resume Next
ActiveSheet.Name = newName
End If
End Sub
Any help would be much appreciated
I am hoping someone can help me with this..So I am trying to create a copy of one worksheet and paste special values. I'd like to be able to choose a name for the worksheet and keep the worksheet within the existing workbook, moving the worksheet to the front. Apoligies if the format is not in line with requirements, this is my first post. I'm pretty sure this part is not correct for some reason - " Before:=ActiveWorkbook.Sheets(1)"
Here is my code:
Public Sub CopySheetToReport()
Dim newName As String
On Error Resume Next
newName = InputBox("Enter the name for the copied worksheet")
If newName <> "" Then
ActiveSheet.Copy.PasteSSpecial Paste:=xlPasteValues
Before:=ActiveWorkbook.Sheets(1)
On Error Resume Next
ActiveSheet.Name = newName
End If
End Sub
Any help would be much appreciated