RE: End(xlDown) function

Discussion in 'Microsoft Excel Programming' started by Gary''s Student, May 10, 2009.

  1. 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?
    >
    >
    >
     
    Gary''s Student, May 10, 2009
    #1
    1. Advertisements

  2. 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
     
    Dave Peterson, May 11, 2009
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tokash

    Selection.End(xlDown) with Rows selected

    Tokash, Aug 19, 2003, in forum: Microsoft Excel Programming
    Replies:
    1
    Views:
    880
    Karen
    Aug 19, 2003
  2. norman

    Selection.End(xlDown) with Rows selected

    norman, Aug 19, 2003, in forum: Microsoft Excel Programming
    Replies:
    0
    Views:
    366
    norman
    Aug 19, 2003
  3. reclusive monkey

    ActiveCell.End(xlDown).Select not working consistently

    reclusive monkey, Oct 8, 2003, in forum: Microsoft Excel Programming
    Replies:
    2
    Views:
    333
    reclusive monkey
    Oct 13, 2003
  4. Dave Peterson

    Re: End(xlDown) function

    Dave Peterson, May 10, 2009, in forum: Microsoft Excel Programming
    Replies:
    0
    Views:
    221
    Dave Peterson
    May 10, 2009
  5. JDB
    Replies:
    1
    Views:
    1,206
Loading...

Share This Page