+ Reply to Thread
Results 1 to 8 of 8

Reading the row number with VBA

  1. #1
    Registered User
    Join Date
    05-09-2006
    Posts
    3

    Reading the row number with VBA

    Hi Everyone
    I have a little UDF that will look for a value in a row and then return the value next to it.
    It works well but I need to supply the row number on which the function resides as an input parameter. There MUST be a way te read the row number automatically. Something like getrow() or whatever.
    Any sugestions would be appreciated.
    Last edited by johan@durban; 05-10-2006 at 05:05 AM.

  2. #2
    Norman Jones
    Guest

    Re: Reading the row number with VBA

    Hi Johan,

    Show your UDF code.

    More generally, use the Row property which returns the (first) row number of
    the range.


    ---
    Regards,
    Norman



    "johan@durban" <johandurban.27l1zy_1147249800.9799@excelforum-nospam.com>
    wrote in message
    news:johandurban.27l1zy_1147249800.9799@excelforum-nospam.com...
    >
    > Hi Everyone
    > I have a little UDF that will look for a value in a row and then return
    > the value next to it.
    > It works well but I need to supply the row number on which the function
    > resides as an input parameter. There MUST be a way te read the row
    > number automatically. Something like getrow() or whatever.
    > Any sugestions would be appreciated.
    >
    >
    > --
    > johan@durban
    > ------------------------------------------------------------------------
    > johan@durban's Profile:
    > http://www.excelforum.com/member.php...o&userid=34266
    > View this thread: http://www.excelforum.com/showthread...hreadid=540570
    >




  3. #3
    Ivan Raiminius
    Guest

    Re: Reading the row number with VBA

    Hi Johan,

    see help for caller property

    Regards,
    Ivan


  4. #4
    aidan.heritage@virgin.net
    Guest

    Re: Reading the row number with VBA

    Not sure what your function does, but

    Function gd()
    gd = ActiveCell.row

    End Function


    returns the row number of the active cell at the time the value is
    entered - possibly a little unsafe as for example you can't autofill it


  5. #5
    Ardus Petus
    Guest

    Re: Reading the row number with VBA

    iRow = Application.Caller.Row

    HTH
    --
    AP

    "johan@durban" <johandurban.27l1zy_1147249800.9799@excelforum-nospam.com> a
    écrit dans le message de news:
    johandurban.27l1zy_1147249800.9799@e...rum-nospam.com...
    >
    > Hi Everyone
    > I have a little UDF that will look for a value in a row and then return
    > the value next to it.
    > It works well but I need to supply the row number on which the function
    > resides as an input parameter. There MUST be a way te read the row
    > number automatically. Something like getrow() or whatever.
    > Any sugestions would be appreciated.
    >
    >
    > --
    > johan@durban
    > ------------------------------------------------------------------------
    > johan@durban's Profile:
    > http://www.excelforum.com/member.php...o&userid=34266
    > View this thread: http://www.excelforum.com/showthread...hreadid=540570
    >




  6. #6
    Registered User
    Join Date
    05-09-2006
    Posts
    3
    Hi everyone
    That was wonderful response in such a short time.
    I am now exploring rather using a range but I am going to try this caller thing first.
    Here is my code:

    Please Login or Register  to view this content.

  7. #7
    paul.robinson@it-tallaght.ie
    Guest

    Re: Reading the row number with VBA

    Hi
    Activecell.row will do it.

    regards
    Paul


  8. #8
    Registered User
    Join Date
    05-09-2006
    Posts
    3
    Thank you everyone.
    The caller property did it for me. I am also going to explore other ways (just for fun).
    Activecell I am afraid does not do the right thing. It seems activecell only works for the cell that was clicked on.
    Last edited by johan@durban; 05-11-2006 at 01:28 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1