Hi Guys

Im trying to create a loop that for a selected/ active cell will look at that cell for a top xl border, if none is found will offset up one row (-1,0) check for the border and will continue until one is found and assign that row value to RwTp
Then it will do the same thing to find a bottom xl border and assign the found row number to RwBtm.

    h = ActiveCell.Row
    j = Selection.SpecialCells(xlCellTypeLastCell).Row

   
    
    Range("A" & h).Select
    If ActiveCell.Borders(xlEdgeTop).LineStyle = xlLineStyleNone Then ActiveCell.Offset(-1, 0).Select Else RwTp = ActiveCell.Row
I have this using an If statement but it doesnt loop until the border is found

any help would be appreciated.