try this link

http://www.ozgrid.com/VBA/delete-sheet-code.htm


On Fri, Jun 27, 2014 at 3:03 AM, Rob Flott <robfl...@gmail.com> wrote:

> My application allows the user to make a copy of a worksheet so it can be
> viewed outside of the application.  The problem I have with this is the
> code written to that specific worksheet.
>
> Is there code I can include in the 'make copy' macro that would remove all
> VB code associated to that sheet?
>
> I appreciate any direction you can provide.
>
> Thank you
>
> Here is my current 'make copy' macro:
>
> Sub MakeCopy()
>     Sheets("Report").Select
>     Sheets("Report").Copy
>     ActiveSheet.Unprotect
>     Application.ScreenUpdating = False
>
>     ActiveSheet.Shapes.Range(Array("Button 1", "Button 2", "Button 3", _
>         "TextBox 12", "Group 6", "Group 9")).Select
>     Selection.Delete
>
>     Rows("4:5").Select
>     Selection.Delete Shift:=xlUp
>
>     Range("A2:A3").Select
>     Selection.Copy
>     Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme,
> Operation:=xlNone _
>         , SkipBlanks:=False, Transpose:=False
>     Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks _
>         :=False, Transpose:=False
>     Application.CutCopyMode = False
>
>     Range("A1").Select
>
>     Application.ScreenUpdating = True
> End Sub
> .......................................
> And here is the code associated with the 'report' sheet:
>
> Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
> 'sorts the datarange based on selected column heading
> Application.ScreenUpdating = False
> If ActiveCell.Address = "$F$7" Then Sheets("List").Range("A20").Value =
> "F:F"
> If ActiveCell.Address = "$G$7" Then Sheets("List").Range("A20").Value =
> "G:G"
> If ActiveCell.Address = "$H$7" Then Sheets("List").Range("A20").Value =
> "H:H"
> If ActiveCell.Address = "$I$7" Then Sheets("List").Range("A20").Value =
> "I:I"
> If ActiveCell.Address = "$J$7" Then Sheets("List").Range("A20").Value =
> "J:J"
> If ActiveCell.Address = "$K$7" Then Sheets("List").Range("A20").Value =
> "K:K"
>
> Call BR_RnkH2L
>
> Application.ScreenUpdating = True
> End Sub
>
> --
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
> https://www.facebook.com/discussexcel
>
> FORUM RULES
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>
> NOTE : Don't ever post confidential data in a workbook. Forum owners and
> members are not responsible for any loss.
> ---
> You received this message because you are subscribed to the Google Groups
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to excel-macros+unsubscr...@googlegroups.com.
> To post to this group, send email to excel-macros@googlegroups.com.
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Regards*

*Ashish Koul*


*Visit*
http://www.excelvbamacros.in
Like Us on Facebook <https://www.facebook.com/excelvbacodes>
Join Us on Facebook <http://www.facebook.com/groups/163491717053198/>


P Before printing, think about the environment.

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to