spreadsheet won't run macro's

hopr37

Board Regular
Joined
Apr 16, 2018
Messages
76
I've tried all the usual solutions.
Checking if automation is on.
cells are not set to text.
Check for Circular References not an issue

The strange thing is if I restart the computer it will sometimes work.
Corrupt excel or something else?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
The code you were posting about in this thread

https://www.mrexcel.com/forum/excel-questions/1052439-debug-error.html

Depends on the Worksheet change event to run. In that code, you have several statements that disable events for certain actions. It is likely that while testing you crashed after disabling events.

Create a small macro and run it to turn events back on:

Code:
Sub FixEvents()
'Reset Events after a crash
    Application.EnableEvents = True
End Sub

or else create a button

Code:
Private Sub CommandButton1_Click()
'Reset Events after a crash
    Application.EnableEvents = True
End Sub
 
Last edited:
Upvote 0
you basically just have to place a number in the "used column" and it should subtract from the "remaining column"
 
Upvote 0
It works fine for me. What version of Excel are you running?
 
Upvote 0
I see that you have a button "CommandButton21" on you main worksheet. However it has no code to execute. You created code for "CommandButton1", which does not exist, so it is possible you never reset EnableEvents to True. Add this code, which should work with the existing "CommandButton21". A message box should display so you'll know if it is executing.

Code:
Private Sub CommandButton1_Click()
    MsgBox "EnableEvents Status: " & Application.EnableEvents, , "Before Reset Attempt"
    'Reset Events after a crash
    Application.EnableEvents = True
    MsgBox "EnableEvents Status: " & Application.EnableEvents, , "After Reset Attempt"
End Sub
 
Upvote 0
That's the button you had me create. I just removed the code. Excel 2010.
so if it works for you but not for me do you have any suggestions?
 
Last edited:
Upvote 0
That's the button you had me create. I just removed the code. Excel 2010.
so if it works for you but not for me do you have any suggestions?

Sorry, that was my cut and paste error. I intended to post code for CommandButton21. Here it is:

Code:
Private Sub CommandButton21_Click()
    MsgBox "EnableEvents Status: " & Application.EnableEvents, , "Before Reset Attempt"
    'Reset Events after a crash
    Application.EnableEvents = True
    MsgBox "EnableEvents Status: " & Application.EnableEvents, , "After Reset Attempt"
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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