Public Function getRowCount(sheet As Variant) As Integer
'Sheets(sheet).Select
If sheet = 0 Then
getRowCount = ActiveSheet.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).row
Else
getRowCount = Sheets(sheet).Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).row
End If
End Function
Public Function getColumnCount(sheet As Variant) As Integer
'Sheets(sheet).Select
If sheet = 0 Then
getColumnCount = ActiveSheet.Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).column
Else
getColumnCount = Sheets(sheet).Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).column
End If
End Function
2015年5月9日星期六
getRowCount
I always use this function to get row count in the excel worksheet.
訂閱:
發佈留言 (Atom)
沒有留言:
發佈留言