+ Reply to Thread
Results 1 to 6 of 6

Variable in ActiveCell.FormulaR1C1?

  1. #1
    Registered User
    Join Date
    02-10-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    58

    Variable in ActiveCell.FormulaR1C1?

    Hello.

    I've been trying to use vba to input a formula into a cell and then offset the reference cell for each subsequent loop.

    What I have is:

    Please Login or Register  to view this content.


    This gives me #NAME? error and I'm not sure how to fix it.

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Variable in ActiveCell.FormulaR1C1?

    I assume i is your variable, you need to put it outside of a string for Excel to recognize it's a variable.
    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Variable in ActiveCell.FormulaR1C1?

    Try this.

    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    02-10-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    58

    Re: Variable in ActiveCell.FormulaR1C1?

    This works! Thanks!!

    Say I want to anchor R[4]C[2], how could I do this? When my code runs down the columns I get D8, D9, D10. I want it all to reference D8 though.

    Please Login or Register  to view this content.
    Edit: My current code

  5. #5
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Variable in ActiveCell.FormulaR1C1?

    D8 is R8C4, basically just remove the square brackets to change it from relative cell to absolute cell referencing.

  6. #6
    Registered User
    Join Date
    02-10-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    58

    Re: Variable in ActiveCell.FormulaR1C1?

    Works perfect! Thanks

+ 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. what is the activecell.FormulaR1C1 method
    By kisanvikas2015 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-23-2015, 06:30 AM
  2. Customize ActiveCell.FormulaR1C1
    By smartbuyer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-26-2013, 10:46 PM
  3. Concatenating literal, with ActiveCell and FormulaR1C1
    By LydiasDad in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-29-2011, 06:40 PM
  4. Replace filename with variable in "Activecell.FormulaR1C1=" expression
    By pommyb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2010, 04:04 PM
  5. ActiveCell.FormulaR1C1 Dynamic Row
    By goldenbear10 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2009, 04:47 AM
  6. [SOLVED] SumIf in ActiveCell.FormulaR1C1 ?
    By RitaP in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2006, 02:20 PM
  7. ActiveCell.FormulaR1C1 Sum Function
    By mb in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-29-2005, 07:05 PM

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