View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
funkymonkUK[_54_] funkymonkUK[_54_] is offline
external usenet poster
 
Posts: 1
Default create a copy of a sheet and insert it into the same workbook.


This is a piece of code I Got.

For Each sh In ActiveWorkbook.Sheets
' below to check if there is a worksheet with the name locally stored
data and if there is one then delet

If sh.Name = "Locally Stored Data" Then
Application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts = True
End If
Next sh

' copys a templatte sheet and then rename it and copy data etc.

Sheets("Temp").Visible = True
Sheets("Temp").Select
ActiveSheet.Copy
ActiveSheet.Name = "Locally Stored Data"
Sheets("Temp").Visible = False
Sheets("Data").Visible = True
Range("A9").Select
Selection.CurrentRegion.Select
Selection.Copy
Sheets("Locally Stored Data").Select
Range("A2").Select


It gets to the highlighted part and then copys the Sheet temp into a
new workbook instead of keeping it in the same workbook. any ideas?


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=387481