+ Reply to Thread
Results 1 to 5 of 5

Relative/Absolute Formula writing in to a cell.

  1. #1
    Hari Prasadh
    Guest

    Relative/Absolute Formula writing in to a cell.

    Hi,

    In the below example z= 2.

    If I put,

    ActiveCell.Formula = "= " & Cells(z, "d").Address

    Then in Cell H8, I get the formula as -- = $D$2 --

    How do I modify my formula such that I get the value as -- = D2 --

    Actually I dont want hard-coded/fixed referencing.

    Thanks a lot,
    Hari
    India



  2. #2
    Hari Prasadh
    Guest

    Re: Relative/Absolute Formula writing in to a cell.

    Hi,

    I recorded a macro for writing formula with absolute/half-absolute
    references and got the following

    Range("D15").Select
    ActiveCell.FormulaR1C1 = "=R[-3]C[-2]"
    Range("G17").Select
    ActiveCell.FormulaR1C1 = "=R14C2"
    Range("C18").Select
    ActiveCell.FormulaR1C1 = "=R12C[-1]"
    Range("B20").Select
    ActiveCell.FormulaR1C1 = "=R[-6]C1"
    Range("D21").Select
    ActiveCell.FormulaR1C1 = "=R[-14]C[-1]"
    Range("D22").Select

    I can understand now that for my purpose I will have to use R1C1 method but
    my problem is that I need to transform -- Cells(z, "d").Address -- where z
    is a variable of for loop... How do I do it?

    Please guide me.


    Thanks a lot,
    Hari
    India

    "Hari Prasadh" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > In the below example z= 2.
    >
    > If I put,
    >
    > ActiveCell.Formula = "= " & Cells(z, "d").Address
    >
    > Then in Cell H8, I get the formula as -- = $D$2 --
    >
    > How do I modify my formula such that I get the value as -- = D2 --
    >
    > Actually I dont want hard-coded/fixed referencing.
    >
    > Thanks a lot,
    > Hari
    > India
    >




  3. #3
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Use:
    ActiveCell.Formula = "= " & Cells(z, "d").Address(rowAbsolute = True, columnabsolute = True)


    - Mangesh

  4. #4
    Tom Ogilvy
    Guest

    Re: Relative/Absolute Formula writing in to a cell.

    Cells(z, "d").Address(0,0)

    --
    Regards,
    Tom Ogilvy


    "Hari Prasadh" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi,
    >
    > I recorded a macro for writing formula with absolute/half-absolute
    > references and got the following
    >
    > Range("D15").Select
    > ActiveCell.FormulaR1C1 = "=R[-3]C[-2]"
    > Range("G17").Select
    > ActiveCell.FormulaR1C1 = "=R14C2"
    > Range("C18").Select
    > ActiveCell.FormulaR1C1 = "=R12C[-1]"
    > Range("B20").Select
    > ActiveCell.FormulaR1C1 = "=R[-6]C1"
    > Range("D21").Select
    > ActiveCell.FormulaR1C1 = "=R[-14]C[-1]"
    > Range("D22").Select
    >
    > I can understand now that for my purpose I will have to use R1C1 method

    but
    > my problem is that I need to transform -- Cells(z, "d").Address -- where z
    > is a variable of for loop... How do I do it?
    >
    > Please guide me.
    >
    >
    > Thanks a lot,
    > Hari
    > India
    >
    > "Hari Prasadh" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi,
    > >
    > > In the below example z= 2.
    > >
    > > If I put,
    > >
    > > ActiveCell.Formula = "= " & Cells(z, "d").Address
    > >
    > > Then in Cell H8, I get the formula as -- = $D$2 --
    > >
    > > How do I modify my formula such that I get the value as -- = D2 --
    > >
    > > Actually I dont want hard-coded/fixed referencing.
    > >
    > > Thanks a lot,
    > > Hari
    > > India
    > >

    >
    >




  5. #5
    Hari Prasadh
    Guest

    Re: Relative/Absolute Formula writing in to a cell.

    Hi Tom,

    Thanks it's working as desired.

    Regards,,
    Hari
    India

    "Tom Ogilvy" <[email protected]> wrote in message
    news:[email protected]...
    > Cells(z, "d").Address(0,0)
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >




+ 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