Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Finding Last value in a column

Currently I am using the following Macro to find the last/bottom value of a
column:

Sheets("Daily").Activate
n = Cells(Rows.Count, "l").End(xlUp).Row
Cells(n, "l").Copy Sheets("Data").Range("D8")

I was wondering if it is possibe to use a function instead if a macro to
find the last vlaue in a column?

Thnaiks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Finding Last value in a column

Perhaps:

Function lastvalueincolumn(r As Range) As Variant
lastvalueincolumn = ""
cl = r.Column
If IsEmpty(Cells(Rows.Count, cl).Value) Then
n = Cells(Rows.Count, cl).End(xlUp).Row
lastvalueincolumn = Cells(n, cl).Value
Else
lastvalueincolumn = Cells(Rows.Count, cl).Value
End If
End Function


used as:

=lastvalueincolumn(A:A)
--
Gary''s Student - gsnu200776


"chris miller" wrote:

Currently I am using the following Macro to find the last/bottom value of a
column:

Sheets("Daily").Activate
n = Cells(Rows.Count, "l").End(xlUp).Row
Cells(n, "l").Copy Sheets("Data").Range("D8")

I was wondering if it is possibe to use a function instead if a macro to
find the last vlaue in a column?

Thnaiks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Finding Last value in a column

=LOOKUP(1E+100,A:A)


Gord Dibben MS Excel MVP

On Mon, 31 Mar 2008 17:54:25 -0700, chris miller
wrote:

Currently I am using the following Macro to find the last/bottom value of a
column:

Sheets("Daily").Activate
n = Cells(Rows.Count, "l").End(xlUp).Row
Cells(n, "l").Copy Sheets("Data").Range("D8")

I was wondering if it is possibe to use a function instead if a macro to
find the last vlaue in a column?

Thnaiks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding max and min in column mikebres Excel Worksheet Functions 3 July 19th 07 07:08 PM
Finding the same value in another column Richard Excel Worksheet Functions 0 April 24th 07 09:26 PM
Finding a number in a column out of an array in another column cirena Excel Discussion (Misc queries) 3 April 4th 07 06:30 PM
Finding Info from Column A and Removing it from Column B Johnny B[_2_] Excel Discussion (Misc queries) 2 March 28th 07 12:06 PM
Finding the closest number in column A and take the value in column B reefguy Excel Worksheet Functions 3 May 5th 06 07:25 PM


All times are GMT +1. The time now is 11:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"