ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   code copy (https://www.excelbanter.com/excel-programming/412212-code-copy.html)

geebee

code copy
 
hi,

i have the following:

Sheets("tester").Copy after:=Sheets("tr")

the "tester" sheet contains code that i would not like to be copied when the
sheet is copied. what can i add to prevent the code from being copied when
the sheet is copied?

thanks in advance,
geebee


Jim Thomlinson

code copy
 
The code is embeded in the sheet so if you copy the sheet then you copy the
code. The easiest way around this is to just create a new sheet and then copy
the cells from tester to the new sheet. Something like this...

Sub CopyTester()
Dim wks As Worksheet

Set wks = Worksheets.Add(After:=Sheets("tr"))
Sheets("tester").Cells.Copy Destination:=wks.Range("A1")

End Sub
--
HTH...

Jim Thomlinson


"geebee" wrote:

hi,

i have the following:

Sheets("tester").Copy after:=Sheets("tr")

the "tester" sheet contains code that i would not like to be copied when the
sheet is copied. what can i add to prevent the code from being copied when
the sheet is copied?

thanks in advance,
geebee


geebee

code copy
 
hi,

thanks... but the only problem with this code is that it does not
handle/copy any radio buttons that are in the sheet to be copied. how can i
copy these radio buttons?

thanks in advance,
geebee


"Jim Thomlinson" wrote:

The code is embeded in the sheet so if you copy the sheet then you copy the
code. The easiest way around this is to just create a new sheet and then copy
the cells from tester to the new sheet. Something like this...

Sub CopyTester()
Dim wks As Worksheet

Set wks = Worksheets.Add(After:=Sheets("tr"))
Sheets("tester").Cells.Copy Destination:=wks.Range("A1")

End Sub
--
HTH...

Jim Thomlinson


"geebee" wrote:

hi,

i have the following:

Sheets("tester").Copy after:=Sheets("tr")

the "tester" sheet contains code that i would not like to be copied when the
sheet is copied. what can i add to prevent the code from being copied when
the sheet is copied?

thanks in advance,
geebee



All times are GMT +1. The time now is 11:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com