PC Review


Reply
Thread Tools Rate Thread

RE: End(xlDown) function

 
 
Gary''s Student
Guest
Posts: n/a
 
      10th May 2009
Function LastRowNum()
Application.Volatile
Set r = Range(Application.Caller.Address)
LastRowNum = r.End(xlDown).Row
End Function

--
Gary''s Student - gsnu200852


"John" wrote:

> I have the following function to return the last row number in a column of
> numbers:
>
> Function LastRowNum()
> Application.Volatile
> LastRowNum = ActiveCell.End(xlDown).Row
> End Function
>
> Problem, I want it to return the last row number starting from the cell the
> function is in, not starting from the active cell. ActiveCell obviously has
> to come out, but what do I replace it with?
>
>
>

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      11th May 2009
This could cause trouble if the function is used in different sheets. The
unqualifed Range() will refer to the activesheet--not the sheet that contains
the formula.



Gary''s Student wrote:
>
> Function LastRowNum()
> Application.Volatile
> Set r = Range(Application.Caller.Address)
> LastRowNum = r.End(xlDown).Row
> End Function
>
> --
> Gary''s Student - gsnu200852
>
> "John" wrote:
>
> > I have the following function to return the last row number in a column of
> > numbers:
> >
> > Function LastRowNum()
> > Application.Volatile
> > LastRowNum = ActiveCell.End(xlDown).Row
> > End Function
> >
> > Problem, I want it to return the last row number starting from the cell the
> > function is in, not starting from the active cell. ActiveCell obviously has
> > to come out, but what do I replace it with?
> >
> >
> >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the "if" function, the "and" function and the "or" function Superblonde64 Microsoft Excel New Users 1 28th Feb 2010 03:13 AM
I have a CLR function thet returns IEnumberable (a table) and it has a FillRow function. I am returning 10,000 integers from this function. Is there any way that I can preallocate the resulting table or give SQL server hint as to how many rows my fun DR Microsoft Dot NET Framework 1 22nd Nov 2007 12:36 PM
I have a CLR function thet returns IEnumberable (a table) and it has a FillRow function. I am returning 10,000 integers from this function. Is there any way that I can preallocate the resulting table or give SQL server hint as to how many rows my fun DR Microsoft ADO .NET 3 22nd Nov 2007 10:17 AM
help function and restore function missing =?Utf-8?B?YXJtaW4=?= Windows XP Help 1 11th Nov 2004 06:12 PM
help function and restore function missing =?Utf-8?B?YXJtaW4=?= Windows XP Help 1 11th Nov 2004 04:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:02 AM.