To make your code easier to follow, try using a Select statement rather than nested Ifs.
This is your code converted with no refinements
Without the rest of your code it isn't clear what you are actually trying to do
...., but the macro is adding what should be going on the P and M variable and is adding it on to the W variable.
I can't see how this is possible from the snippet provided.
You might be better to post a desensitised workbook with the relevant code included.
so that we can better understand your aims.
Bookmarks