View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
deano deano is offline
external usenet poster
 
Posts: 26
Default lastcell in thiscolumn function error

Cheers all,
I wrote a UFD to return address of last cell of a column of data. The
function takes a cell reference in the column of interest as its
argument.

For example The data is in a range on worksheet1 B2:D6, lastcellref(b2)
should return $b$6

the Function code is:

Function lastcellref(thiscolumn As Variant)
Dim lastcell As Variant
Set lastcell = Cells(1001, thiscolumn.Column).End(xlUp)
Set lastcellref = lastcell.AddressLocal(RowAbsolute:=True,
columnabsolute:=True)
End Function

when I run this function, I get Run time error 424, object required.
what am I doing wrong?