vba-获取某一个sheet某一列最大行

Function getLastRow(ByVal sheetName As Worksheet, ByVal columnName As String) As Long
    Dim maxRow As Long
    If Right(rptfile, 3) = "xls" Then
        maxRow = sheetName.[A65536].End(xlUp).Row
    Else
        maxRow = sheetName.[A1048576].End(xlUp).Row
    End If
    getLastRow = maxRow
End Function

 参考:http://www.doczj.com/doc/d25518136-2.html

posted @ 2022-12-04 17:31  vba是最好的语言  阅读(416)  评论(0编辑  收藏  举报