That's all great, I'm really pleased it's worked out for you. To exclude the hidden cells try adding the bit in red:

ar = shMeta.UsedRange.SpecialCells(xlCellTypeVisible)
I haven't tested it, but it could do the trick!!