+ Reply to Thread
Results 1 to 4 of 4

Mixed references in VBA formulas

  1. #1
    Registered User
    Join Date
    09-24-2009
    Location
    Atkinson, NH
    MS-Off Ver
    Excel 2003
    Posts
    23

    Mixed references in VBA formulas

    I want to enter a formula in a column of cells on a spreadsheet. The formula needs to be entered from VBA. I can enter the formula in the top cell using, for example Range("D2").FormulaR1C1 = "= ...." I have no problem entering the formula as long as all cells in the formula are entered using relative references. However, I want some of the cells in the formula to be absolute references, so when I copy the formula down the column the absolute references continue to refer to the same cells. Is there a way to do this, and if so, how?
    Last edited by McNultyK; 07-20-2011 at 06:09 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,481

    Re: Mixed references in VBA formulas

    Put the formula you want to end up with in the cell, absolute and relative references as you choose.

    Then record a macro, select the cell, press F2 and press Enter. Stop the recording.

    That will give you the basic code which you can edit as required.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    09-24-2009
    Location
    Atkinson, NH
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Mixed references in VBA formulas

    Works great! Many thanks!!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,481

    Re: Mixed references in VBA formulas

    You're welcome. Thanks for the rep.

+ 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