PDA

View Full Version : How to completely delete the content of the enire sheet



Rasm
10-28-2011, 06:07 AM
The code below is what I use to clear my sheet -



ActiveSheet.UsedRange.ClearContents


However when I then execute the code below - only the data is cleared - so in effect the column/row counts still are in place - what is the best best way to not only clear the sheet - but also clear the column/row count. I have ActiveX controls (not form controls) directly on my sheet - but those I want to keep.


If I have to - I can add the ActiveX controls via code - after I clear the sheet - but would prefer not to do that.







With ActiveSheet.UsedRange
LastRow = .Rows(.Rows.Count).Row
ColLast = .Columns(.Columns.Count).Column
End With

Admin
10-28-2011, 09:27 AM
Hi

Use
ActiveSheet.UsedRange.Clear

Then save the workbook.