Surprising you got so many views and no reply, cause the answer is already there in your code...
the "lr = Worksheets("Sheet1").Cells(Rows.Count, "P").End(xlUp).Row" finds the last row of data in column "P" (hence lr).
So instead of making direct references to 3677, it should refer to lr.
For this to work, generally change codes where ranges are specifically mentioned as follows.
Example (before)
Example (after)
(you can actually lose the '$' as well and clear up your code)
In your code, it's changing the occurrences of "$3677" to " & lr"
Please click the * below if this helps
Bookmarks