Computer Aided Automation

Full Version: Excel AUTOFILL WITH VBA
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

1. open a new file and insert button
2. save as macro enabled excel file
3. assign macro to the button and paste below code

Sub Button1_Click()

Dim range1 As Range

Dim range2 As Range
Set range1 = Sheet1.Range("A1:A2")

Set range2 = Sheet1.Range("A1:A10")

range1.AutoFill Destination:=range2

End Sub