saloelrn1988
New Member
- Joined
- Apr 14, 2020
- Messages
- 32
- Office Version
- 365
- Platform
- Windows
hi Guys please help,
I tried creating/saving a new sheet with pivot table using macro, how ever when I run my macro and create another sheet the source data of my pivot table would still be from the original sheet and everytime I refresh it messes up may data from the previous sheet. see below code I used to use:
Sub Copy_Sheet()
Sheets("template").Copy After:=Sheets(Sheets.Count)
On Error Resume Next
ActiveSheet.Name = Range("A2").Value
On Error GoTo 0
Sheets("template").Select
End Sub
I tried creating/saving a new sheet with pivot table using macro, how ever when I run my macro and create another sheet the source data of my pivot table would still be from the original sheet and everytime I refresh it messes up may data from the previous sheet. see below code I used to use:
Sub Copy_Sheet()
Sheets("template").Copy After:=Sheets(Sheets.Count)
On Error Resume Next
ActiveSheet.Name = Range("A2").Value
On Error GoTo 0
Sheets("template").Select
End Sub