vba - Clear contents and formatting of an Excel cell with a single command -


if want clear contents of cell or range in microsoft excel, can use .clearcontents. if want clear formatting, can use .clearformats.

sheets("test").range("a1:c3").clearcontents sheets("test").range("a1:c3").clearformats 

if want both, can use .delete, other cells in spreadsheet shift replace deleted cells.

sheets("test").range("a1:c3").delete 

how can remove contents and formatting of cell or range in vba single command, without affecting rest of worksheet?

use .clear method.

sheets("test").range("a1:c3").clear 

msdn documentation here.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -