How to remove cells or rows if not bold in Excel?
Supposing you have a range of data with bolded cells and not bolded cells as below screenshot shown, now what you need is to remove the cells or rows if not bolded. Instead of removing not bolded cells one by one manually, this tutorial introduces the tricks for you to quickly solve it in Excel.
v Remove rows if not bolded with VBA
To remove rows if not bolded, you can use a VBA code to handle.
1. Press F11 + Alt keys to enable the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, then pasted below VBA code to the new Module window.
VBA: Remove rows if not bolded.
Sub DeleteNonBolded() 'UpdatebyKutoolsforExcel20151116 Dim xRg As Range Dim xDelRg As Range Dim xAddress As String Dim xUpdate As Boolean Dim I As Long Dim xBold As Variant On Error Resume Next xAddress = Application.ActiveWindow.RangeSelection.Address Set xRg = Application.InputBox("Select a range", "Kutools for Excel", xAddress, , , , , 8) Set xRg = Application.Intersect(xRg, ActiveSheet.UsedRange) If xRg Is Nothing Then Exit Sub If xRg.Areas.Count > 1 Then MsgBox "This VBA cannot support multiple range", , "Kutools for Excel" Exit Sub End If xUpdate = Application.ScreenUpdating Application.ScreenUpdating = False For I = 1 To xRg.Rows.Count xBold = xRg.Rows(I).Cells.Font.Bold If TypeName(xBold) = "Boolean" Then If xBold = False Then If xDelRg Is Nothing Then Set xDelRg = xRg.Rows(I).EntireRow Else Set xDelRg = Union(xRg.Rows(I).EntireRow, xDelRg) End If End If End If Next xDelRg.Delete Application.ScreenUpdating = xUpdate End Sub
3. Press F5 key to run the VBA code. In the popping up Kutools for Excel dialog box, please specify the range you will remove rows without bold cells, and click the OK button.
And then you can see the rows which doesn’t contain bolded cells have been removed
Note: the rows can be removed only when all cells in the same row are not bolded.
If you just want to remove the cell contents from not bolded cells, you can use Find and Replace function to select the bolded cells first, then use Kutools for Excel’s Select Range Helper to reverse selecting the not bolded cells, then remove the contents.
1. Select the data range where you want to remove not bolded cells, and press Ctrl + F to enable Find and Replace dialog, and click at Options button. See screenshot:
2. Click Format to go to the Find Format dialog, and under Font tab, select Bold from the Font style list. See screenshot:
3. Click OK > Find All, and all the bolded cells are listing in the Find and Replace dialog, and press Ctrl +A to select all of them, then close the Find and Replace dialog. See screenshot:
4. Then keep these cells selected and click Kutools > Select > Select Range Helper. See screenshot:
5. In the popping dialog, check Inverse Selection option firstly, and then select the original data range. Now you can see the selection are reversed. See screenshot:
6. Click Close. Now press Delete key to remove the cell contents from the not bolded cells.
Above methods are not easy enough, in this case, you can use Kutools for Excel’s Select Cells with Format utility to quickly identify not bolded cells, and then remove them.
|Kutools for Excel, with more than 300 handy functions, makes your jobs more easier.|
After free installing Kutools for Excel, please do as below:
1. Select the data range you need, and click Kutools > Select > Select Cells with Format. See screenshot:
2. In the popping dialog, click Choose Format From Cell button to select one not bolded cell form the data range, then check Bold only from the below list in Font section. See screenshot:
3. Click Ok, and a dialog pops out to remind you the number of selected cells, just click Yes to close it.
Now all the not bolded cells are selected, and press Delete key to remove the cell contents. Or if you want to remove the not bolded rows, right click any one of selected cells and select Delete > Entire row. See screenshots:
- How to convert hyperlinks to plain text in Excel?
- How to count if cells are start with or end with specific text in Excel?
- How to count and remove duplicates from a list in Excel?