Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a worksheet with an event handler:
Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo xitsub If Target.Address = "$W$7" Then After_AIF Else End If xitsub: End Sub The After_AIF function is in "Module1" which I delete when the workbook is saved: 'Delete VB Code Dim x As Object Set x = Application.VBE.ActiveVBProject.VBComponents x.Remove VBComponent:=x.Item("Module1") My question is how do I delete the "Private Sub Worksheet_Change(ByVal Target As Range)" sub? I'm getting what is apparently a compile error before the "new" workbook closes. I've tried: x.Remove VBComponent:=x.Item("worksheet").code and several variants of the VBComponenet:= thingy without success.. TIA ABC |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
remove code from behind worksheet | Excel Programming | |||
Remove / Add code through VBA | Excel Programming | |||
VBA Code to remove VBA | Excel Programming | |||
Use VB code to remove code in sheet1 | Excel Programming | |||
Remove VBA code | Excel Programming |