Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi I need to delete formaulas when a sheet deactivates but the formulas in the next sheet thats acivated are deleted instead, is there a way to do this? (the formaulas are copied in when the worksheets are activated) Private Sub Worksheet_Deactivate() ActiveSheet.Unprotect Password:="naWages" Range("AG17:AH41").Select Application.CutCopyMode = False Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("AY17:CI42").Select Selection.ClearContents Range("A1").Select ActiveSheet.Protect Password:="naWages" End Sub Regards Neil *** Sent via Developersdex http://www.developersdex.com *** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm not sure, but it might be because you have already deactivated the sheet.
So the activeworksheet command is focused on the new sheet. Try referencing the sheet by name using sheets("name of sheet") instead of the activesheet reference. "Neil Atkinson" wrote: Hi I need to delete formaulas when a sheet deactivates but the formulas in the next sheet thats acivated are deleted instead, is there a way to do this? (the formaulas are copied in when the worksheets are activated) Private Sub Worksheet_Deactivate() ActiveSheet.Unprotect Password:="naWages" Range("AG17:AH41").Select Application.CutCopyMode = False Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("AY17:CI42").Select Selection.ClearContents Range("A1").Select ActiveSheet.Protect Password:="naWages" End Sub Regards Neil *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting cell data without deleting formula | Excel Discussion (Misc queries) | |||
Worksheet_Deactivate() problem with deleting data | Excel Programming | |||
Capturing the selected tab in a worksheet_deactivate macro | Excel Programming | |||
Excel – Macro Problem – Inserting, Appending Data, Deleting | Excel Programming | |||
Row deleting script problem | Excel Programming |