+ Reply to Thread
Results 1 to 9 of 9

Writing a Formula using R1C1 code in VBA code

  1. #1
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Writing a Formula using R1C1 code in VBA code

    Dear Forum,

    I am writing a macro where I need to write a Formula in a specific column C based on the contents and the row size of the Column B..

    Ex: The formula starts from the StartRow = 2 in the Column C and the LastRow of the Column A...
    Its a simple Countif Formula to be auto inputted each time the Macro is run..

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

    Can someone help me with the code in the column C based on the COlumn which is also a formula converted to a value...

    Warm Regards
    e4excel

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Writing a Formula using R1C1 code in VBA code

    You may try:
    Please Login or Register  to view this content.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Writing a Formula using R1C1 code in VBA code

    Thanks a lot, Izandol...
    It worked like a charm, please explain how to make the columns absolute as well as the rows...

    I am not able to make out which line does the trick , i would prefer to make the columns absolute..

    Regards
    e4xcel

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Writing a Formula using R1C1 code in VBA code

    You must change:
    Please Login or Register  to view this content.
    to absolute numbers:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Writing a Formula using R1C1 code in VBA code

    Thanks again but does the number 2 or [-1] have anything to do with making the Absolutes?

  6. #6
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Writing a Formula using R1C1 code in VBA code

    C2 is always column 2; C[-1] is one column to the left from formula cell, which may be any column.

  7. #7
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Writing a Formula using R1C1 code in VBA code

    Then what makes the COlumns And the Rows Absolute

  8. #8
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Writing a Formula using R1C1 code in VBA code

    If it is simply a number like 2 it is absolute. If it is within [] like [-1] it is relative to the formula cell.

  9. #9
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Writing a Formula using R1C1 code in VBA code

    No my question was not just that but how do i make it locked , the way we do using "$" in regular formulas...if I need to use the [-1] as well as "$"

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Formula in a Marco - I need help writing the code which uses find and replace
    By PFDave in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2013, 06:07 AM
  2. Macro code .. to find and paste or writing a formula.
    By ajkh89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2013, 12:51 PM
  3. Help needed for creating array and writing formula in VBA, code included
    By yanheng in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-14-2012, 02:00 PM
  4. How to use a range name in R1C1 code
    By skysurfer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-08-2010, 06:30 PM
  5. VBA Code for Selective formula writing
    By Fuerteventura in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-24-2005, 10:05 AM

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