Sorry my bad.
It's not strange, as in my side it also still leave the last highlighted row,
while the image in my post, I make another code to get rid off that last highlighted row
.
Here is my way to get rid off that last highlighted row :
Please make a new module, so there is no "Option Explicit",
copy the code below then paste to the new module.
And for the worksheet module (again, please no "Option Explicit") :
The code above set the last column header number (cl) and the the last row number in column A (lr)
If the active cell is bigger than cl or bigger than lr,
it will remove the Conditional Formatting in the sheet (by calling the stopFill Sub),
this stopFill Sub will not remove the "fill" formatting in the sheet.
Then it directly exit the sub.
If the active cell is smaller than cl or smaller than lr (so it's within the "table range"),
then it put the Conditional Formatting in the sheet (by calling the setFill Sub).
setFill Sub won't do Conditional Formatting each time it's called,
as it will check first whether the sheet has any Conditional Formatting or not (yes/no).
If yes, then it directly exit the sub. If no, then it write the Conditional Formatting.
PS:
Please don't forget to change the code where it read
Range("A:S") according to your need,
and also change the
("Sheet1") according to your need.
Bookmarks