How to find and replace all blank cells with certain number or text in Excel?
For a range of cells which are populated with some blank cells, you may need to find these blank cells and replace them with certain content. In this article, we provide three methods for you.
Recommended Excel Productivity Tools
You can use the Find and Replace function to replace all blank cells with certain content in Excel. Please do as follows.
1. Select the range with blank cells you need to replace with certain content, then press Ctrl + H keys simultaneously to open the Find and Replace dialog box.
2. In the popping up Find and Replace dialog box, under the Replace tab, keep the Find what box blank, enter the certain text you want to replace the blank cells into the Replace with box, and finally click the Replace All button. See screenshot:
3. Click the OK button in the following dialog box.
Then all blank cells in selected range are replaced with certain content.
You can also apply the VBA method to replace all blank cells with certain content in a range. Please do as follows.
1. Press the Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Application window.
2. In the Microsoft Visual Basic for Application window, click Insert > Module, and then copy and paste below VBA code into the Module window.
VBA code: Replace blank cells with certain content
Sub Replace_Blanks() Dim xStr As String Dim xRg As Range Dim xCell As Range Dim xAddress As String Dim xUpdate As Boolean On Error Resume Next xAddress = Application.ActiveWindow.RangeSelection.Address Set xRg = Application.InputBox("Please select a range", "Kutools for Excel", xAddress, , , , , 8) Set xRg = xRg.SpecialCells(xlBlanks) If (Err <> 0) Or (xRg Is Nothing) Then MsgBox "No blank cells found", , "Kutools for Excel" Exit Sub End If xStr = Application.InputBox("Replace blank cells with what?", "Kutools for Excel") xUpdate = Application.ScreenUpdating Application.ScreenUpdating = False For Each xCell In xRg xCell.Formula = xStr Next Application.ScreenUpdating = xUpdate End Sub
3. Press the F5 key to run the code. In the Kutools for Excel dialog box, select the range with blank cells you need to find and replace, and then click the OK button.
4. In another Kutools for Excel dialog box, enter the certain content into the textbox, and click the OK button. See screenshot:
Then all blank cells are replaced with certain text immediately as you specified above.
Note: If the selected range does not contain blank cells, you will get the following dialog box.
The Fill Blank Cells utility of Kutools for Excel helps you easily fill all blank cells with certain content. Please do as follows.
|Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.|
1. Select the range with blank cells you need to fill with certain content, and then click Kutools > Insert > Fill Blank Cells. See screenshot:
2. In the Fill Blank Cells dialog box, check the Fixed value option in the Fill with section, and then enter the certain content into the Filled value box, finally click the OK button.
Then all blank cells in selected range are filled with the content as below screenshot shown.
Note: With this utility, you can also fill blank cells based on values, and fill blanks with linear values.