Stop searching. Start learning and developing your excel skills.
Macro
VBA
Formula
Function
Shortcut
Tricks

» » VBA Function To AutoFill Down

VBA Function To AutoFill Down

June 03, 2017 |
This is also related to below queries:
  1. vba autofill to last row
  2. vba autofill formula
  3. excel vba autofill dynamic range
  4. autofill vba variable range
  5. excel vba autofill down
  6. selection.autofill destination to last row
  7. vba autofill multiple columns
The Code:
Dim i As Long
Application.ScreenUpdating = False
i = Cells(Rows.Count, "A").End(xlUp).Row
Selection.AutoFill Destination:=Range("A2:A" & i)
Range("A2:A" & i).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Where:

i = number of rows to autofill

Note:
  1. Range("A2:A" & i). Begins with A2. Change :A" to your desired column if you have multiple cells
  2. The operation will perform autofill then copy the autofill range/ areas and then copy paste special values. You may remove this if you wish to keep the formula

No comments:

Post a Comment