+ Reply to Thread
Results 1 to 6 of 6

Code to fill down formula

  1. #1
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Code to fill down formula

    Hello.
    I ran the code below but it did not execute at all and instead highlighted in yellow a part of the code (see red font). This is the workbook i'm working with Fill Down Formula.xlsm

    Please Login or Register  to view this content.
    Any ideas?
    Thanks.
    Last edited by kosherboy; 02-07-2014 at 12:11 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
    44,630

    Re: Code to fill down formula

    You need something like:

    Please Login or Register  to view this content.

    However, that's not right because, if you put that formula in column 2, it refers to column XFC, etc

    Regards, TMS
    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
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Code to fill down formula

    Thanks for the reply. I still need help with the code.

    I have a suggestion:
    In reference to the section in the code which takes the second to last column in the 18th row, so for arguments sake we will call this cell G18, and multiply the retail by the cost (the cost being in cell A1 which happens to be 0.3) Is there a way to have the last row in this code to equal to the last cell (with data in it) in column A but at the same time still identify cell G18 as the cell in the 18th row on the 2nd to last column? Meaning, I don't want to refer to G18 as: Range(Cells(18, lc), Cells(lr - 1, lc)) but rather as: Range(Cells(18, lc)) since I strongly feel that Excel is getting confused which is the last row.
    Last edited by kosherboy; 02-07-2014 at 12:34 PM.

  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
    44,630

    Re: Code to fill down formula

    Just:
    Please Login or Register  to view this content.

    Regards, TMS

  5. #5
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Code to fill down formula

    Thanks.
    So I modified the code to look like this (see below), good news there are no error messages but the excel sheet itself is not completing the way I want it to.

    Please Login or Register  to view this content.

  6. #6
    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
    44,630

    Re: Code to fill down formula

    ... not completing the way I want it to.
    Describe what you DO want it to do. Tell us the worksheet formula(s) you want and which cells you want it/them in ... not the code, the actual formula(s) you want to end up with and the cells you want it/them to be in.

    You misunderstand; "Cells" is something of a misnomer in this case:
    Please Login or Register  to view this content.
    ... is a single cell in row 18, in the next to the last column, so not much point looping through it

+ 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. [SOLVED] help on vba code to fill range with formula to all splited files
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2014, 11:02 PM
  2. VBA code to fill blank cells with variable formula
    By Khen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2014, 08:24 AM
  3. Replies: 6
    Last Post: 11-28-2012, 07:29 PM
  4. Auto fill text using formula or code
    By nicmarty in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-29-2010, 09:26 AM
  5. Fill formula with code
    By WhiteKelso in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-15-2007, 05:28 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