Thread: [Solved] lastincolumn function
View Single Post
 
Old 01-30-2010, 03:28 PM
zyzzyva57 zyzzyva57 is offline Windows 7 Office 2007
Expert
 
Join Date: Mar 2009
Location: Dawsonville, Ga (NE of Atl)
Posts: 355
zyzzyva57 is on a distinguished road
Default

Here are some ideas to try:

Function LastInColumn(a As Range)
LastInColumn = Range("a1").Cells(1048576, a.Column).End(xlUp).Address
End Function

====================

Function LastInRange(InputRange As Range)
LastInRange = InputRange.Cells(InputRange.SpecialCells(xlLastCel l).Row +
1, InputRange.Column).End(xlUp)
End Function

Or shorten it by using the With statement:

Function LastInRange(InputRange As Range)
With InputRange
LastInRange = .Cells(.SpecialCells(xlLastCell).Row + 1, .Column).End(xlUp)
End With
End Function
Reply With Quote