如何找到包含特定列中数据的最后一行?如何找到在特定列和特定工作表中包含数据的最后一行?
3 回答
PIPIONE
TA贡献1829条经验 获得超9个赞
Function GetLastRow(strSheet, strColumn) As Long Dim MyRange As Range Set MyRange = Worksheets(strSheet).Range(strColumn & "1") GetLastRow = Cells(Rows.Count, MyRange.Column).End(xlUp).RowEnd Function
Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
摇曳的蔷薇
TA贡献1793条经验 获得超6个赞
.End(xlup)
sheetvar.Rows.Count
慕运维8079593
TA贡献1876条经验 获得超5个赞
function LastRowIndex(byval w as worksheet, byval col as variant) as long dim r as range set r = application.intersect(w.usedrange, w.columns(col)) if not r is nothing then set r = r.cells(r.cells.count) if isempty(r.value) then LastRowIndex = r.end(xlup).row else LastRowIndex = r.row end if end ifend function
? LastRowIndex(ActiveSheet, 5)? LastRowIndex(ActiveSheet, "AI")
添加回答
举报
0/150
提交
取消