Disable Worksheet Change Event

SewStage

Board Regular
Joined
Mar 16, 2021
Messages
70
Office Version
  1. 365
Platform
  1. Windows
I no longer need this change event, but even though I've deleted the macro it's still performing copy/paste functionality that's starting to mess with my spreadsheet. How do I stop this, especially since I've deleted the macro? Is it as "simple" as creating it again with Application.EnableEvents = False?

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Intersect(Target, Sheets("Material Usage").Range("B5:B35")) Is Nothing Then
    Sheets("Material Usage").Select
    Range("B5:B35").Select
    Application.CutCopyMode = False
    Selection.Copy
  
    Sheets("Product Completion by Mo.").Select
    Range("B5").Select
    ActiveSheet.Paste
End If
Application.EnableEvents = True
End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Once you delete a macro it can no longer perform, so, the only thought I have is that you have the same code in the ThisWorkbook module with the name:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
 
Upvote 0
Once you delete a macro it can no longer perform, so, the only thought I have is that you have the same code in the ThisWorkbook module with the name:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Hey thanks rollis. I have two other modules/macros in this workbook and neither of them have that code. Would it be hidden somewhere? Embedded outside a module? Would it work to save the workbook as a non-macro-enabled workbook (and then go back and recreate the macros I need and save it as a macro-enabled workbook again)?
 
Last edited:
Upvote 0
Maybe there is something hidden in the Excel's XLSTART folder.
 
Upvote 0
Is there any chance of sharing your file? You can get rid of all the data first if you like - not needed to solve this problem.
 
Upvote 0
Maybe there is something hidden in the Excel's XLSTART folder.
I just changed my macro settings in the Trust Center Settings to Disable VBA macros except digitally signed macros...and that appears to have disabled that particular code. Ah crud - it disabled the other macros, too, and as soon as I re-enabled the one I don't want came back.
 
Upvote 0
Is there any chance of sharing your file? You can get rid of all the data first if you like - not needed to solve this problem.
Sure! Don't know how to do that here though other than XLBB and I had to get rid of it because it was crashing my system every time I tried to use it.
 
Upvote 0
Share your file via Google Drive, Dropbox or similar file sharing platform & post the link here. Just remember to make the file available to anyone with the link.
 
Upvote 0
Is there any chance of sharing your file? You can get rid of all the data first if you like - not needed to solve this problem.
Would it help to see the other two modules/macros I'm running? I didn't write them - know very little about VBA - but maybe there's something in there that will stand out for you that I'm not seeing?
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top