Public Function sheetslastrow(ByVal r As String) As Long Dim s, i As Long s = Sheets.Count maxRow = 0 For i = 1 To s maxRow = WorksheetFunction.Max(maxRow, Sheets(i).Cells(65536, r).End(xlUp).Row) Next i sheetslastrow = maxRow End Function =sheetslastrow("C") Public Function sheetslastrow1(ByVal r As Range) As Long Dim s, i As Long s = Sheets.Count maxRow = 0 For i = 1 To s maxRow = WorksheetFunction.Max(maxRow, Sheets(i).Cells(65536, r.Column).End(xlUp).Row) Next i sheetslastrow1 = maxRow End Function =sheetslastrow1(C:C)
|