excel vba - Difference finding last row in VBA -


i have 3 ways of finding last row in col a. diffrence? , 1 best use.

nr 1 range("a" & rows.count).end(xlup).row  nr 2 cells.find(what:="*", after:=range("a1"), searchorder:=xlbyrows, searchdirection:=xlprevious).row  nr 3 dim col, row, lastrow integer  col = 1 row = 1 lastrow = 1  lastrow = cells(rows.count, col).end(xlup).row cells(lastrow, col).select 

one way row number of last filled cell in column a :

sub lastfilledcellincolumna()     dim wf worksheetfunction, nlastrowa long     set wf = application.worksheetfunction     nlastrowa = rows.count     if wf.counta(cells(nlastrowa, 1)) = 1         msgbox nlastrowa         exit sub     end if     nlastrowa = cells(rows.count, "a").end(xlup).row     msgbox nlastrowa end sub 

if column empty 1 output


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -