简体   繁体   中英

Excel 2007 VBA - How to delete all row in a spreadsheet excluding the rows in one column

How can i delete/clear all rows except for one column using excel VBA?

Additional info: i have one column with formulas computing a certain thing using values from other columns which i am importing from access database.

Any work around if i dont want to delete the formula in the one column but want to delete everything else?

Use SpecialCells to return only Cells of certain types

To delete all constants use:

ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants).ClearContents

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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