VBA code not working anymore?

David77

Board Regular
Joined
Jun 24, 2020
Messages
109
Office Version
  1. 365
Platform
  1. Windows
Hello everybody,

I am currently managing a stock tracking file, which is edited manually to a large extent.

Currently, the four significant columns look like this:



Here, column I is the actual quantity in stock. If my code was functioning, which it was as of yesterday (and I have made no edits whatsoever to it), any number entered into column J should subtract that number from the quantity (so I4 should be 550 - 50 = 50 in the case above for example) after which the number also disappears from column J. The same applies for column K, where it just adds quantity rather than subtracts.

Finally, column L should track any point in time where the quantity changes in value (so we can see if any of the quantities have not been touched for longer periods of time).

This all worked as of yesterday, but as of this morning (central European time) none of these codes work anymore, neither the subtraction, addition or date & time columns.

My VBA code for this entire flow looks like this:



Can anybody assist me in figuring out what the problem is and how to potentially fix it so it all works again? It would be truly amazing and would really make my day!

Thank you so much everybody :)

Best regards,
David
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Could be that this line has not been run : Application.EnableEvents=True
.
Try closing Excel and reopening.
 
Upvote 0
Could be that this line has not been run : Application.EnableEvents=True
.
Try closing Excel and reopening.
Feel free to try out the code if you can get it work!

I will try your idea in the meantime, thank you!
 
Upvote 0
Did you close and restart Excel completely, not just that workbook?
 
Upvote 0
Did you close and restart Excel completely, not just that workbook?
Hello RoryA,

I did. Now it seems like my formulas are working again, however Excel crashes constantly.

Am I running too many macros or something? I have x2 command buttons and 1-2 other macros (so 2 sheets with 2 macros each approximately).
 
Upvote 0
What exactly do you mean by "crash"? Do you get errors, or does it literally stop working and disappear?
 
Upvote 0
What exactly do you mean by "crash"? Do you get errors, or does it literally stop working and disappear?
It just crashes - no errors, just shuts down.

I tried to recreate my excel sheet into a new sheet now with ONLY one this one macro and it still crashes. So for some reason my macro has stopped functioning now (despite working as of yesterday for about a week in a row).

How do I fix this? It highlights the following:

1597313335437.png
 
Upvote 0
Are you using ActiveX command buttons? If so, try replacing them with Form controls instead. I'd also suggest using:

Code:
For each c in r.cells

instead of:

Code:
 for each c in r
 
Upvote 0
Are you using ActiveX command buttons? If so, try replacing them with Form controls instead. I'd also suggest using:

Code:
For each c in r.cells

instead of:

Code:
 for each c in r
Hello Rory,

I did this but I still get the same error as before, please note:
1597314344617.png


1597314356494.png


P.S. I appreciate your help so much, truly - thank you! My other thread was not a complete copy of this, I had actually copied my entire sheet to a new excel document to test if the flaws was due to me having too many macros or info (which it was not). So it is definitely my macro that has problems. I also gave some more elaborative details in the other sheet, but nonetheless, I appreciate your help a lot here and it's fine that you locked the other one thus :)
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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