jkluio668
12/12/2017 - 2:55 AM

unempty_row_adjacent

get next unempty row number in its column ,especially in tree format by comparing iterations of columns ahead with each other.

Sub unempty_row_adjacent_select()
    a1 = Selection.Row
    b1 = Selection.Column
    b1s = convert1(b1)
    '----------------------
    If Cells(a1, b1) <> "" Then begin1 = ed(a1, b1, , 1) Else begin1 = eu(a1, b1, , 1)
    end1 = 65536
    col_b_left = 6
    For i = b1 To col_b_left Step -1
        atmp = ed(begin1 + 1, i, , 1)
        end1 = Application.Min(end1, atmp)
    Next
    r1 = ActiveSheet.UsedRange.Find(what:="*", searchorder:=xlByRows, searchdirection:=xlPrevious).Row
    end1 = Application.Min(end1, r1)
    'MsgBox begin1 - 1 & " " & end1 - 1
    If begin1 + 1 <= end1 - 1 Then Range(b1s & begin1 + 1 & ":" & b1s & end1 - 1).Select
End Sub