+ Reply to Thread
Results 1 to 20 of 20

VBA to fill formula down till last row in column.

  1. #1
    Forum Contributor
    Join Date
    12-21-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    387

    VBA to fill formula down till last row in column.

    Hi,

    I'm working on a project and I'm trying to get my VBA code to draw down the formula that's in cell "U3" all the way down to the end of the data set.
    I'm using column "A".

    I want to copy formula with userform command button.

    example: If There are values till cell "A3:A25" then I want to copy formula in column "U3:U25",

    and when user Add Data in column "A" in "A26:A36 and hit command button same formula copy in column "U26:U36.

    So in excel my formula in cell "U3" is =G3&","&L3.

    Thanks.
    My English is very poor, so please be patient >_<"

    Thanks & Regards.
    hkbhansali

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: VBA to fill formula down till last row in column.

    See next code
    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: VBA to fill formula down till last row in column.

    Another option
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    12-21-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    387

    Re: VBA to fill formula down till last row in column.

    Hi PCI,

    Above code I have copy in module and run it but nothing happen!!!

  5. #5
    Forum Contributor
    Join Date
    12-21-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    387

    Re: VBA to fill formula down till last row in column.

    Hi Fluff13,

    I have copy CODE in module and run it but nothing happen!!!

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: VBA to fill formula down till last row in column.

    Is the sheet you want the code to work on, the active sheet?
    If not what is the sheet name?

  7. #7
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: VBA to fill formula down till last row in column.

    Can you first run the macro without any button or others:
    Select the sheet to treat
    Launch the macro
    What's happen ??

  8. #8
    Forum Contributor
    Join Date
    12-21-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    387

    Re: VBA to fill formula down till last row in column.

    Yes, I work on active sheet..sheet name is "Summary"

  9. #9
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: VBA to fill formula down till last row in column.

    Yes, I work on active sheet..sheet name is "Summary"
    So when launching the macro from developer ...what is the result ?

  10. #10
    Forum Contributor
    Join Date
    12-21-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    387

    Re: VBA to fill formula down till last row in column.

    Hi PCI,

    Sorry, your code works fine, it was my mistake row "A450:U450" was merge and I have unmerge it and code works fine.

    thanks alot and I realy apologies .

  11. #11
    Forum Contributor
    Join Date
    12-21-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    387

    Re: VBA to fill formula down till last row in column.

    Hi Fluff13

    Sorry, your code works fine, it was my mistake row "A450:U450" was merge and I have unmerge it and code works fine.

    thanks alot and I realy apologies .

  12. #12
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VBA to fill formula down till last row in column.

    Hello hkbhansali,

    Similar to what Fluff13 has suggested, this will also work.

    Please Login or Register  to view this content.
    Regards.
    Last edited by Winon; 07-12-2018 at 04:20 PM.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  13. #13
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: VBA to fill formula down till last row in column.

    Quote Originally Posted by hkbhansali View Post
    Sorry, your code works fine, it was my mistake row "A450:U450" was merge and I have unmerge it and code works fine.

    thanks alot and I realy apologies .
    Glad we could help & thanks for the feedback

  14. #14
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VBA to fill formula down till last row in column.

    It is not necessary to use FillDown in the Code.

  15. #15
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VBA to fill formula down till last row in column.

    @ Fluff13,

    Nice going Fluff13.

    Try my Code to eliminate FillDown.

    Regards.

  16. #16
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: VBA to fill formula down till last row in column.

    Try my Code to eliminate FillDown
    What is the benefit ?

  17. #17
    Forum Contributor
    Join Date
    12-21-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    387

    Re: VBA to fill formula down till last row in column.

    Helllo Winon,

    First line of your code mark Red Colour (Error)
    Range("U3:U" & Range("A" & Rows.Count).End(xlUp).Row).Formula = "=G3&","&L3"
    Last edited by hkbhansali; 07-12-2018 at 01:34 PM.

  18. #18
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: VBA to fill formula down till last row in column.

    Quote Originally Posted by Winon View Post
    @ Fluff13,

    Nice going Fluff13.

    Try my Code to eliminate FillDown.

    Regards.
    Once I add the extra " to your code
    Please Login or Register  to view this content.
    It worked fine
    I just felt that FillDown was easier

  19. #19
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: VBA to fill formula down till last row in column.

    Thanks you hkbhansali, for the rep.

  20. #20
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VBA to fill formula down till last row in column.

    Hi hkbhansali,

    Yes you are right.

    Sorry, my bad!

    The correct Code is shown below.

    Please Login or Register  to view this content.
    @ PCI,

    What is the benefit ?
    Much less lines and no need to tell the system to do what it will be doing in any case.

    @ Fluff13,

    Good catch! I forgot to add the extra quotes as required by VBA. Big mistake!

    Regards.

+ 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] copy formula and fill down till last not blank cells
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2017, 07:24 AM
  2. [SOLVED] Need vba to fill format the datevalue in column right till end of value and formula across
    By johnmacpro in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-01-2016, 10:07 AM
  3. [SOLVED] VBA to fill the formula across row and column till total
    By johnmacpro in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-13-2016, 09:25 AM
  4. [SOLVED] VBA to fill the formula in every set of range till end of row data
    By johnlara in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-30-2016, 10:50 AM
  5. [SOLVED] VBA to fill formula down till last row in column
    By Wither125 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-25-2016, 06:03 PM
  6. Sum till the column till the date match
    By ursanil in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-02-2014, 06:29 AM
  7. Help with Macro: I need to fill columns D-N only up till the row number in column A
    By zizou0178 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-19-2014, 02:16 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