Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub GetLastRow(strSheet, strColum)
- Dim MyRange As Range
- Dim lngLastRow As Long
- Set MyRange = Worksheets(strSheet).Range(strColum & "1")
- lngLastRow = Cells(65536, MyRange.Column).End(xlUp).Row
- End Sub
- 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 if
- end function
- ? LastRowIndex(ActiveSheet, 5)
- ? LastRowIndex(ActiveSheet, "AI")
- Function LastRow(rng As Range) As Long
- Dim iRowN As Long
- Dim iRowI As Long
- Dim iColN As Integer
- Dim iColI As Integer
- iRowN = 0
- iColN = rng.Columns.count
- For iColI = 1 To iColN
- iRowI = rng.Columns(iColI).Offset(65536 - rng.Row, 0).End(xlUp).Row
- If iRowI > iRowN Then iRowN = iRowI
- Next
- LastRow = iRowN
- End Function
- Selection.End(xlDown).Select
- MsgBox (ActiveCell.Row)
- Public Function LastData(rCol As Range) As Range
- Set LastData = rCol.Find("*", rCol.Cells(1), , , , xlPrevious)
Add Comment
Please, Sign In to add comment