|
Function GetRowCountByColumn(strPath, strSheetName, strColumnNum)
Dim i, iRowCount, xlApp, OpenExcel
Set xlApp = CreateObject("Excel.Application")
Set OpenExcel = xlApp.Workbooks.Open(strPath)
iRowCount = OpenExcel.WorkSheets(strSheetName).UsedRange.Rows.Count
For i = 1 To iRowCount
If OpenExcel.WorkSheets(strSheetName).Cells(iRowCount - i + 1, strColumnNum) <> "" Then
GetRowCountByColumn = iRowCount - i + 1
Exit For
End If
Next
If GetRowCountByColumn = "" Then
GetRowCountByColumn = 0
End If
OpenExcel.Close
Set xlApp = Nothing
End Function |
|