Copy sheet for temporary working.

  • Thread starter Thread starter Chris Watts
  • Start date Start date
C

Chris Watts

I wish to make a temporary copy of a sheet so that I can work on it without
altering the original spread. I then want to delete the temporary copy at
the end of the process. All within a vba macro. What is the best technique
for achieveing this?

I have tried using SaveCopyAs but it doesn't quite achieve what I want. It
leaves you working on the original and a messy tidy up seems necessary

Guidance welcomed.

TIA
Chris
 
Hi Chris:

Here is an example. We start from the sheet we want to copy:

Sub Macro1()
Dim original As Worksheet
Set original = ActiveSheet
original.Copy After:=Sheets(1)
ActiveSheet.Name = "temporary"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' your code goes here
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sheets("temporary").Delete
original.Activate
End Sub
 
Thanks Gary - that will do it for me!
Chris

Gary''s Student said:
Hi Chris:

Here is an example. We start from the sheet we want to copy:

Sub Macro1()
Dim original As Worksheet
Set original = ActiveSheet
original.Copy After:=Sheets(1)
ActiveSheet.Name = "temporary"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' your code goes here
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sheets("temporary").Delete
original.Activate
End Sub
 
Back
Top