I have a filtered range. in that range, I want to determine if any two row numbers are consecutive; for instance, if Rows 3, 5 9,10,12, and 14 are visible, then 9 and 10 are consecutive. For those rows, i want to cut row 8 and paste it between them.

If there are two consecutive rows, above them are two divider rows, so one needs to be cut and moved. If there are 3 consecutive rows, then there would be 3 divider rows above them, so I'd need to do the same sort of operation, cutting two of those rows above and pasting between the 3 below.

I've been trying to wrap my head around it and can't figure out how to begin. Any help would be appreciated.