简体   繁体   English

清除除第一行和第一列之外的所有数据

[英]Clear All Data EXCEPT First Row and First Column

Would like to clear all data except Row 1 and Column A. Am able to clear all except the first row OR first column using something like this:想要清除除第 1 行和 A 列之外的所有数据。我能够使用以下内容清除除第一行或第一列之外的所有数据:

Rows("2:" & Rows.Count).ClearContents

But would like to know how to keep both in when clearing.但想知道如何在清除时保持两者。 (In the worksheet, the first row and column are both "frozen.") (在工作表中,第一行和第一列都“冻结”。)

For example, clear B2 to the very last cell:例如,清除B2到最后一个单元格:

With ActiveSheet
   .Range("B2", .Cells(.Rows.Count, .Columns.Count)).ClearContents
End With

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM