If you run a code such as B1.value = “something”, nothing will change in the spreedsheet, you will not find the value even if you use msgbox to show B1.value. Merged cell such as A1:C1, the value always lies in the cell on the top left (A1). To clear merged cell, first you need to understand how merged cells behave. Run -time error ‘1004’: We can’t do that to a merged cell
Clear merged cell contentsįor merged cells, you may not use ClearContents directly on the Cell object as you do on a single cell, otherwise you will receive an error message. No matter which method is used, the result will return TRUE if you use IsEmpty() Function on the cell. There are two ways to clear single cell contents (clear value in a Cell but not formatting)Īssume that you want to clear contents in cell A1, then do one of the followings Method 1: Range("A1").value = "" Method 2: Range("A1").ClearContents
Clear single cell contents with ClearContents
I will also explain how to clear single cell contents, clear merged cells contents, and clear blank cells. There are several kinds of “clear” related Excel VBA Methods for different scenarios. This Excel tutorial explains how to clear cell contents / clear cell formats using Clear, ClearContents, ClearFormats Method.