Autofill Syntax:

     

     

    Filldown Types:

     

     

     

    AutoFill - Types

     

     

    Private Sub CommandButton1_Click()
    Range("A2:A3").AutoFill Destination:=Range("A2:A100"), Type:=xlFillCopy
    Range("B2:B3").AutoFill Destination:=Range("B2:B100"), Type:=xlFillDays
    Range("C2:C3").AutoFill Destination:=Range("C2:C100"), Type:=xlFillDefault
    Range("D4:D100").Value = "Apple"
    Range("D2:D3").AutoFill Destination:=Range("D2:D100"), Type:=xlFillFormats
    Range("E2:E3").AutoFill Destination:=Range("E2:E100"), Type:=xlFillMonths
    Range("F2:F3").AutoFill Destination:=Range("F2:F100"), Type:=xlFillSeries
    Range("G2:G3").AutoFill Destination:=Range("G2:G100"), Type:=xlFillValues
    Range("H2:H3").AutoFill Destination:=Range("H2:H100"), Type:=xlFillWeekdays
    Range("I2:I3").AutoFill Destination:=Range("I2:I100"), Type:=xlFillYears
    End Sub

     

    Fill down Default

     

     

     

    Private Sub CommandButton1_Click()
    Range("A1:A7").AutoFill Destination:=Range("A1:A100"), Type:=xlFillDefault
    Range("B1:B7").AutoFill Destination:=Range("B1:B100"), Type:=xlFillDefault
    Range("C1:C7").AutoFill Destination:=Range("C1:C100"), Type:=xlFillDefault
    End Sub

     

     

    AutoFil Method

     

  • It fills entire range
  •  

     

    Private Sub CommandButton1_Click()
    Range("A1").Value = "Sunday"
    Range("A2").Value = "Monday"
    Range("A1:A2").AutoFill Destination:=Range("A1:A100"), Type:=xlFillDays
    Range("B1").Value = "January"
    Range("B2").Value = "February"
    Range("B1:B2").AutoFill Destination:=Range("B1:B100"), Type:=xlFillMonths
    Range("C1").Value = "2000"
    Range("C2").Value = "2001"
    Range("C1:C2").AutoFill Destination:=Range("C1:C100"), Type:=xlFillYears
    End Sub

     

     

     

    Filldown Method

  • Make sure cell value G2 should be in range "G2:G"& max")
  •  

    Private Sub CommandButton1_Click()
    Dim i As Integer
    Max = Range("A1").End(xlDown).Row
    Range("G2").Formula = "=E2*F2"
    Range("G2:G" & Max).FillDown
    Range("G2:G" & Max).Copy
    Columns("G").Copy
    Columns("G").PasteSpecial Paste:=xlValues
    Application.CutCopyMode = xlCopy
    End Sub

     

     

     

     

    Open HTML file name

     

  • We can open HTML file name from the below
  •  

    Workbooks.Open Filename:="F:\abc.html"

     

  • To Save Workbook:
  • Thisworkbook.SaveAs Filename:="D:\abc.html", FileFormat:=xlHTML