I need some expert advice on VBA code. I have created a procedure to compare two short reports (the same format, generated from the system). I used the for
loop starting from the first row until the last one using UsedRange.Rows.Count
. The problem I have is that UsedRange.Rows.Count always return 30 even though the reports are generally shorter than that - usually around 20-25 rows. It returns 30 even if I clear the content inside these rows. It only returns the correct number when I permanently delete the blank rows up to row 30.
Why is that happening? It bothers me because also for some reason the macro highlights the blank rows (from the last actually used to row 30) showing them as a difference between the reports, while they exist and are the same (blank) in both.
Thank you