Input Data to next available row Excel C# -
hello there anyway next empty row in excel , allow data input row? have looked on internet , found nothing looks this. 1 idea came add row evertime , input row, wondering if there easier way go this. appreciated. thanks
one thing careful on .usedrange can select row ghost data on (where data may have been deleted, has left legacy data behind- such formats). here, leave blank rows need deleted.
if have column in data cannot empty, pretty easy- use the
range("a1").end(xldown).row
method. if looking next available empty row (where column can populated/empty), use find function it. like;
sub unusedrow() dim lstartrow long dim lunusedrow long lstartrow = 3 'starting row no in case have blank rows @ top lunusedrow = lstartrow - 1 application.screenupdating = false on error resume next while lstartrow = lunusedrow + 1 lunusedrow = lstartrow lstartrow = cells.find("*", cells(lunusedrow, 1), , , xlbyrows, xlnext).row + 1 loop on error goto 0 application.screenupdating = true end sub
the advantage of selects true next empty row (ie more data exists after row finds).
Comments
Post a Comment