Let's say the name of the sheet is Sheet1
Then
One code clear all content
ThisWorkbook.Sheets("Sheet1").Cells.ClearContents
and other code clear all contents starting from 2nd row till the last row whatever it is.
You can find the last row and then clear the contents. But why would you want to do that? Simply Clear ALL
rows after the 2nd Row?
With ThisWorkbook.Sheets("Sheet1")
.Rows("2:" & .Rows.Count).ClearContents
End With
If you still want to clear all contents starting from 2nd row till the last row then see THIS on how to find the last row and once you get the last row then simply use this
With ThisWorkbook.Sheets("Sheet1")
.Rows("2:" & LastRow).ClearContents
End With
Note:
- The above code will fail if say Cell
A1:A2
is merged. So be careful of that :)
- This code will clear the cells but not delete any shapes/formatting. You will have to handle it separately.