I think your probelm is here:

lRows = ActiveSheet.UsedRange.Rows.Count
it should be:

lRows = ActiveSheet.UsedRange.Rows