Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-29-2010, 01:36 PM
rdcsfd rdcsfd is offline lastincolumn function Windows 7 lastincolumn function Office 2007
Novice
lastincolumn function
 
Join Date: Jan 2010
Posts: 3
rdcsfd is on a distinguished road
Default lastincolumn function

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
Reply With Quote
 



Similar Threads
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
lastincolumn function Help! for using an appropriate function/Macro in Excel pawan2paw Excel 1 06-04-2009 12:28 PM
lastincolumn function Need help on what function to use??? Primeraman Excel 1 06-13-2006 10:16 AM
Help with Combination function sanasath Excel 0 12-13-2005 07:24 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft