+ Reply to Thread
Results 1 to 4 of 4

Get cell address from macro function argument

  1. #1
    oscar
    Guest

    Get cell address from macro function argument

    Is it possible to know the address of the cell that is passed as argument to
    a macro function? I want to know this to compare to the cell next to the one
    passed to the function.

  2. #2
    Gary''s Student
    Guest

    RE: Get cell address from macro function argument

    Yes:

    Function qwerty(r As Range) As Integer
    MsgBox (r.Offset(0, 1).Address)
    qwerty = 0
    End Function



    --
    Gary's Student


    "oscar" wrote:

    > Is it possible to know the address of the cell that is passed as argument to
    > a macro function? I want to know this to compare to the cell next to the one
    > passed to the function.


  3. #3
    oscar
    Guest

    RE: Get cell address from macro function argument

    Thank you for your reply.

    Is it possible to use that macro in the formula bar?
    I tryed with =qwerty(A1) and I got #NAME?

    Thank you for your time

    "Gary''s Student" wrote:

    > Yes:
    >
    > Function qwerty(r As Range) As Integer
    > MsgBox (r.Offset(0, 1).Address)
    > qwerty = 0
    > End Function
    >
    >
    >
    > --
    > Gary's Student
    >
    >
    > "oscar" wrote:
    >
    > > Is it possible to know the address of the cell that is passed as argument to
    > > a macro function? I want to know this to compare to the cell next to the one
    > > passed to the function.


  4. #4
    Gary''s Student
    Guest

    RE: Get cell address from macro function argument

    Yes you can.

    First you need to copy the 4 line function and paste it in VBA editor. See:

    http://www.mvps.org/dmcritchie/excel/getstarted.htm

    --
    Gary's Student


    "oscar" wrote:

    > Thank you for your reply.
    >
    > Is it possible to use that macro in the formula bar?
    > I tryed with =qwerty(A1) and I got #NAME?
    >
    > Thank you for your time
    >
    > "Gary''s Student" wrote:
    >
    > > Yes:
    > >
    > > Function qwerty(r As Range) As Integer
    > > MsgBox (r.Offset(0, 1).Address)
    > > qwerty = 0
    > > End Function
    > >
    > >
    > >
    > > --
    > > Gary's Student
    > >
    > >
    > > "oscar" wrote:
    > >
    > > > Is it possible to know the address of the cell that is passed as argument to
    > > > a macro function? I want to know this to compare to the cell next to the one
    > > > passed to the function.


+ 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