I have been tasked with debugging some code at work and have found an easy fix for it, but don't understand why it works..
The original code:
For x = 6 to Cells(10000, 1).End(xlUp).Row
The "repaired" code:
last_row = Cells(10000, 1).End(xlUp).Row
For x = 6 to last_row
It was originally not running the For loop, as if it made Cells(10000, 1).End(xlUp).Row = 0.
But now it works. I just want to know if there is a reason for this or if it's just a coincidence.
Thank you for your help.
The original code:
For x = 6 to Cells(10000, 1).End(xlUp).Row
The "repaired" code:
last_row = Cells(10000, 1).End(xlUp).Row
For x = 6 to last_row
It was originally not running the For loop, as if it made Cells(10000, 1).End(xlUp).Row = 0.
But now it works. I just want to know if there is a reason for this or if it's just a coincidence.

Thank you for your help.