Deleting columns/rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to clear a worksheet once the workbook opens; however, I don't want to
delete the header row and I don't want to delete/clears functions in column R
and S. How do I accomplish this?
 
This will clear A:Q and T:IV.
range(Cells(2, "A"), cells(rows.count, "Q")).ClearContents
range(Cells(2, "T"), cells(rows.count, columns.count)).ClearContents

Are there and constants in R:S that you want cleared? If so then add this ...
On Error Resume Next
Range("R2", Cells(Rows.Count,
"s")).SpecialCells(xlCellTypeConstants).ClearContents
On Error GoTo 0

**Note the above should be 3 lines but it will probably show up as 4 lines.
 
That was perfect, thank you for your help!!

Jim Thomlinson said:
This will clear A:Q and T:IV.
range(Cells(2, "A"), cells(rows.count, "Q")).ClearContents
range(Cells(2, "T"), cells(rows.count, columns.count)).ClearContents

Are there and constants in R:S that you want cleared? If so then add this ...
On Error Resume Next
Range("R2", Cells(Rows.Count,
"s")).SpecialCells(xlCellTypeConstants).ClearContents
On Error GoTo 0

**Note the above should be 3 lines but it will probably show up as 4 lines.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top