+ Reply to Thread
Results 1 to 4 of 4

How to AutoFill from Last Column down to Last Row

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    818

    How to AutoFill from Last Column down to Last Row

    Hello All,
    I need help to autofill the formula from last column down to the last row. Please help me to fix the below:

    Dim LCc As Long, LRr As Long
    Set LCc = Sheets("GEN2_CSP").Range("A1").End(xlToRight).Offset(0, 1)
    LCc.Formula = "=IFERROR(1/(1/SUMIF(BA:BA,B1,BD:BD)),"""")"
    Dim LRr As Long
    LRr = Range("A" & Rows.Count).End(xlUp).Row
        With LCc
            .AutoFill Destination:=Range("LCc" & LRr).Resize(, 1), Type:=xlFillSeries  <=== got error here
        End With
    Regards,
    tt3
    Last edited by tuongtu3; 10-04-2015 at 03:41 AM.

  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
    49,898

    Re: How to AutoFill from Last Column down to Last Row

    Maybe:

    Dim LCc As Long, LRr As Long
    With Sheets("GEN2_CSP")
        LCc = .Range("A1").End(xlToRight).Offset(0, 1).Column
        LRr = .Range("A" & .Rows.Count).End(xlUp).Row
        .Cells(1, LCc).Resize(LRr).Formula = "=IFERROR(1/(1/SUMIF(BA:BA,B1,BD:BD)),"""")"
    End With

    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
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    818

    Re: How to AutoFill from Last Column down to Last Row

    Hi TMS,
    The code works and after done: how to enter the Formula at the last column= "=SUM(F2:" & Last Column)"
    (let say last column is AA then Formula at AB2 .Formula = "=SUM("F2:AA2")"

    Regards,
    tt3

  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
    49,898

    Re: How to AutoFill from Last Column down to Last Row

    Sub Test2()
    Dim LCc As Long, LRr As Long
    With Sheets("GEN2_CSP")
        LCc = .Cells(1, .Columns.Count).End(xlToLeft).Column
        LRr = .Range("A" & .Rows.Count).End(xlUp).Row
        .Cells(2, LCc + 1).Resize(LRr - 1).Formula = "=SUM(F2:" & Split(Cells(2, LCc).Address, "$")(1) & "2)"
    End With
    End Sub

    Regards, TMS

+ 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] Autofill column,using column (skipping some cells) from another sheet
    By excellover2212 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-06-2014, 01:09 PM
  2. [SOLVED] AutoFill the first emty column based on the values of the last filled column
    By runneer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-20-2013, 01:04 PM
  3. Need help with Macro to autofill formula in Column B based on length of Column A
    By soxsrules in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-06-2013, 02:43 PM
  4. Worksheet function to Autofill formula in column A when data entered in column B
    By boylers75 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2013, 02:27 PM
  5. [SOLVED] VBA Code Required to autofill formulated column according to the adjacent column
    By bonny24tycoon in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-30-2012, 12:05 PM
  6. Autofill a column based on number in adjacent column
    By fbonetti in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-08-2011, 04:19 PM
  7. Copy/move a word from a cell in a column to another column and autofill
    By excelaspire0219 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2009, 03:54 PM
  8. autoFill column equal to adjacent column
    By Paulg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-17-2006, 08:04 AM

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