+ Reply to Thread
Results 1 to 11 of 11

How to specify a range using cell references?

  1. #1
    Registered User
    Join Date
    01-25-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    17

    How to specify a range using cell references?

    In this mockup, the blue columns are text, the orange column is a formula.
    excelforum1.jpg

    I have working code that adds a new row to the bottom of a table, copies over some cells from a different tab, and then copies the formula from the bottom cell (D6) into the new row's formula cell (D7). I need this to be flexible, so I don't hard-code any cells, but use .Range(1,4) of the last row to specify my formula cell.

    Please Login or Register  to view this content.
    I now have multiple formula columns instead of just one (below I show 3 orange formula columns), so I now need to copy the formulas from D6:F6 into D7:F7.
    excelforum3.jpg

    I tried a few different ways of updating the "Set formulaCells" and "newRow.Range" statements using Range and Cells but none of my trials worked.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    How do I specify this range of cells without having to hard-code the cell names?
    Last edited by AliGW; 05-26-2021 at 12:59 AM.

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How to specify a range using cell references?

    in a table you dont have to copy formulas, in your case, when you put data
    in first 3 columns, columns with formulas get automatic populated.

    Kind regards
    Leo

  3. #3
    Registered User
    Join Date
    01-25-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: How to specify a range using cell references?

    Leo, I wish that were the case, but that's not what's happening. When I copy my data from another tab, it's just the 3 blue columns A:C. Columns D:F show up as #N/A after the copy operation (the formulas do not auto-fill). Which is why I'm having to find them from the previous row and paste them in.

  4. #4
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How to specify a range using cell references?

    Is it a table table, or is it range you call table ?

  5. #5
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How to specify a range using cell references?

    maybe show us the file

  6. #6
    Registered User
    Join Date
    01-25-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: How to specify a range using cell references?

    It's a table table (not a range). I discovered why my formula columns were filling with #N/A. It's because of how I populate the new row. I'm copying something 1row, 3columns wide and pasting it into something 1row, 6columns wide. So columns 4,5,6 (D:F) are filling with #N/A.

    So I still need to know how to specify a range based on relative cell references. When I copy my source range (which is 1row by 3columns) I need to paste it into just the first 3 columns of my new row so that I don't fill the formula columns with #N/A.

    I continue to try all sorts of different combinations of .Range(Cell1,Cell2) but I can't get anything to work.

  7. #7
    Registered User
    Join Date
    01-25-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: How to specify a range using cell references?

    Another way to ask would be:

    The following will fill the first cell of my new row with "abc". This works.
    Please Login or Register  to view this content.
    How can I fill the first 3 columns of my new row with "abc". I can't get this to work (without doing it long-hand like this):
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How to specify a range using cell references?

    so dont copy row but only the 3 columns

  9. #9
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How to specify a range using cell references?

    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How to specify a range using cell references?

    or
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    01-25-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: How to specify a range using cell references?

    .Resize solved my problem. Thanks! I ended up with the following for those specific problem lines.

    Please Login or Register  to view this content.

+ 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. Copying range to another range using constructed cell references
    By Nickoby in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-07-2015, 12:14 PM
  2. Replies: 1
    Last Post: 06-18-2014, 03:13 AM
  3. [SOLVED] Have a Range reference and need to get two cell references.
    By RBissell in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-26-2013, 07:16 AM
  4. Make a range out of two cell references
    By ChrisNor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2009, 07:23 AM
  5. Range that references to cell for the Row
    By liquidskin in forum Excel General
    Replies: 7
    Last Post: 07-24-2008, 06:53 PM
  6. [SOLVED] How to rename references from range names to cell references
    By Abbas in forum Excel General
    Replies: 1
    Last Post: 05-24-2006, 01:25 PM
  7. [SOLVED] Replace range names with cell references?
    By Bernie Deitrick in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2005, 07:05 AM

Tags for this Thread

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