This isn't working with my actual spreadsheet/data.

I can't think of what the difference would be between my sample and my actual data.

I'm getting an error as follows: "subscript out of range"

and it points to this row when I debug

m = Worksheets(ShtName).Range("A" & Rows.Count).End(xlUp).Row


Any ideas?