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.
Find and replace all blank cells with Find and Replace function
Find and replace all blank cells with VBA code
Easily fill all blank cells in a range with Kutools for Excel
Find and replace all blank cells with Find and Replace function
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.
Easily fill all blank cells with certain value in Excel:
Kutools for Excel's Fill Blank Cells utility helps you easily fill all blank cells in selected range with certain number or text in Excel as the below demo shown.
Download and try it now! (30-day free trail)
Find and replace all blank cells with VBA code
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.
Easily fill all blank cells in a range with Kutools for Excel
The Fill Blank Cells utility of Kutools for Excel helps you easily fill all blank cells with certain content. Please do as follows.
1. Select the range with blank cells you need to fill with certain content, and then click Kutools > Insert > Fill Blank Cells.
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.
If you want to have a free trial (30-day) of this utility, please click to download it, and then go to apply the operation according above steps.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!