What confuses me is that nowhere in your script does it seem to be looking for that "X", so writing one doesn't affect anything, so you don't need that part.
Instead, try this then.
I see there are several instances of E24615, which is the last row of your sheet. There is a way around that, which is simple enough.
First, do this :
Put that whenever you need to know what's the last row in your sheet. If you add lines (like adding a title), you need to add this line again, just to make sure you know where the last row is everytime.
Next, do a simple Search/Replace.
Search for 24615" (include the " in this case)
Replace by exactly this : " & Lastrow (don't forget the " again)
So it should look like this in the various places it appears :
I put underlines to get your attention on the changes you should be seeing. Everywhere the 24615 appears should be replaced by LastRow, which will be the last row of your sheet. It's using variables in this case.
Variables CANNOT be inside Quotes. Instead you need to close the quotes, use & to tie it with LastRow. That's how VBA works.
Hope this helps.
Bookmarks