Explain about CLEAR Method

     

     

  • Clear method clears Range and formatting of cells
  •  

  • Clearcontents method clears only data, not formats
  •  

     

     

    Clear across the sheets

     

     

    Clear across the sheets - For Next Loop

     

    Private Sub CommandButton1_Click()
    Dim shcount As Integer
    shcount = Worksheets.Count
    For i = 1 To Sheets.Count
    Sheets(i).Select
    ActiveSheet.Cells.Clear
    Next
    End Sub

     

     

    Clear across the sheets - For Each Loop

     

    Private Sub CommandButton1_Click()
    Dim sh As Worksheet
    For Each sh In ThisWorkbook.Sheets
    sh.Activate
    ActiveSheet.Cells.Clear
    Next
    End Sub