Created a 'do while' code, which runs very slow.
Below is the labelClass code
do while.PNG
Here is the do while code
dowhile.PNG
Appreciate any feedback
Regards
Margo
Created a 'do while' code, which runs very slow.
Below is the labelClass code
do while.PNG
Here is the do while code
dowhile.PNG
Appreciate any feedback
Regards
Margo
Last edited by margo71; 12-31-2021 at 03:54 PM.
What is the activecell when you launch the macro ?
What is the purpose of the macro ?
- Battle without fear gives no glory - Just try
Hi,
Column M is the active cell.
The purpose is to let client know the current stock level, so they know what to order.
Column L will be removed in the final file
Thank you,
Margo
See file attached
Maybe this:
Please Login or Register to view this content.
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
Thank your for your code.
Your code kept starting from Cell M1. So all I did is adding the expression 'Application.ScreenUpdating = False' - and the code runs in a fraction of a second.
Merci Beaucoup et bonne année
Margo
Thank you. I just kept my simple codes and statements and only added expression 'Application.ScreenUpdating = False', which solved the problem.
Your code is slow because you select cells. ScreenUpdating = False masks the issue because the screen is not being redrawn. That said, if the volume of data is small, it does resolve your problem (as you state).
I suspect the original code only appears to be slow because you are watching the active cell move down the screen and the cells being updated.
Merci, toi aussiMerci Beaucoup et bonne année
By the way, you got all explanations from TMS about how slow could be your code, but there is still some improvement to do, working with memory.
It could be useful for some others,
Just for fun, this uses arrays so the bulk of the work is done in memory. It locates the stock in hand column, stores the values in an attay, loops through it and creates another array of "labels", and outputs it the next available column. It should be virtually instantaneous.
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks