(10-15-2023, 12:13 PM)SMcNeill Wrote:(10-15-2023, 11:50 AM)bplus Wrote: Y'all did see the code that skipped the IF test altogether, just added in everything and then subtracted out the one thing not wanted. Time wise, BIG savings!
Code: (Select All)nc = 0
FOR i = -1 TO 1
FOR j = -1 TO 1
nc = nc + Cells(x + j, y + i)
NEXT
NEXT
nc = nc - Cells(x, y)
Yeah I like how yours takes the calc's out of the For loop and puts them in the counting line.
Part of what makes Steve amazing is that he is also a connoisseur of coding method.
b = b + ...