none
Selection.AutoFill Destination RRS feed

  • Question

  • Hello

    I'm Rio

    I have a problem with selection.autofill destination

    I want a button that can copy a formula until the last cell

    My formula is on range ("AB4") in sheets ("Check per week")  in workbook ("Checking.xlsx")

    It is located on different workbook with my macro or button

    I want to copy the formula until last cell with autofill destination like doing double click on bottom right corner in a cell that contain formula

    please kindly help me to solve my problem

    Thank you

    Friday, February 17, 2017 8:54 AM

Answers

  • See if this does what you want:

    Sub FillIt()
        Dim LastRow As Long
        Application.ScreenUpdating = False
        With Workbooks("Checking.xlsx").Worksheets("Check per week")
            LastRow = .Cells.Find(What:="*", SearchOrder:=xlByRows, _
                SearchDirection:=xlPrevious).Row
            .Range("AB4").AutoFill Destination:=.Range("AB4:AB" & LastRow)
        End With
        Application.ScreenUpdating = True
    End Sub
    


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by riok58 Monday, February 20, 2017 2:23 AM
    Friday, February 17, 2017 11:54 AM

All replies

  • See if this does what you want:

    Sub FillIt()
        Dim LastRow As Long
        Application.ScreenUpdating = False
        With Workbooks("Checking.xlsx").Worksheets("Check per week")
            LastRow = .Cells.Find(What:="*", SearchOrder:=xlByRows, _
                SearchDirection:=xlPrevious).Row
            .Range("AB4").AutoFill Destination:=.Range("AB4:AB" & LastRow)
        End With
        Application.ScreenUpdating = True
    End Sub
    


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by riok58 Monday, February 20, 2017 2:23 AM
    Friday, February 17, 2017 11:54 AM
  • It works

    Perfect

    Thank you very much

    Monday, February 20, 2017 2:23 AM