Last Active Sheet
You are better off to avoid the selecting in the first place. Rarely in a
macro do you actually need to select anything...
dim wks as worksheet
set wks = activesheet
Sheets.Add After:=Sheets(Sheets.Count)
Sheets("APS Structure").Cells.Copy _
Destination:=wks.range("A1")
--
HTH...
Jim Thomlinson
"Freddy" wrote:
I am trying to put together a very simple piece of code that copies data from
one sheet and pastes into another
However every time a new worksheet is created the code cannot find the last
active sheet
Example:
Sheets.Add After:=Sheets(Sheets.Count)
Sheets("APS Structure").Select
Cells.Select
Range("AD7").Activate
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
How do I change the "sheet2" to the last active sheet I was viewing?
Your help is much appreciated
|