• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Auto Fill

Did you mean E2? You just have a 0 in it. It will autofill with the same number (0,0,0, etc.). If you meant to calculate, then you should have =C2-D2 in cell E2. With that in place, the following code will do the autofill:
Code:
Sub autofillblocks()
Dim lastrow As Integer
Dim range1 As String
    lastrow = Range("A:D").Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    range1 = "E2:E" & lastrow
    Range("E2").Select
    Selection.AutoFill Destination:=Range(range1)
    Range(range1).Select
End Sub
 
Back
Top