![]() |
#1
|
|||
|
|||
![]()
lastincolumn is a walkenbach function that returns the value for the last filled cell in a column. works well and is very fast.
Function LASTINCOLUMN(rngInput As Range) Dim WorkRange As Range Dim i As Integer, CellCount As Integer Application.Volatile Set WorkRange = rngInput.Columns(1).EntireColumn Set WorkRange = Intersect(WorkRange.Parent.UsedRange, WorkRange) CellCount = WorkRange.Count For i = CellCount To 1 Step -1 If Not IsEmpty(WorkRange(i)) Then LASTINCOLUMN = WorkRange(i).Value Exit Function End If Next i End Function the following function, lastinrange, is a modification of lastincolumn to return the location/range of the last filled cell in a column, necessary to use with offset function. But, it is excruciatingly slow. does anyone know why? Function LastInRange(InputRange As Range) Dim CellCount As Long Dim i As Long CellCount = InputRange.Count For i = CellCount To 1 Step -1 If Not IsEmpty(InputRange(i)) And IsNumeric(InputRange(i)) Then Set LastInRange = InputRange(i) Exit Function End If Next i LastInRange = "" End Function |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cross-reference function with Visio? | Barometer | Word | 0 | 11-04-2009 12:38 PM |
Outlook 2003/ Send to function | ptservice | Outlook | 0 | 09-24-2009 07:09 AM |
![]() |
pawan2paw | Excel | 1 | 06-04-2009 12:28 PM |
![]() |
Primeraman | Excel | 1 | 06-13-2006 10:16 AM |
Help with Combination function | sanasath | Excel | 0 | 12-13-2005 07:24 AM |