Hello everyone,
I have a cell with several lines, i would like to search for "1º", and when find bold that whole line.
I found a macro that finds a text and bold it: (But has a lot of uncessary stuff i don't need like input box and stuff., only need to find 1º and bold line )
My Cell A1 is like this:
3º ABC
2º ABB
1º ACCC
5º ASDASD
5º ASDAS
6º ASDA
Essential what i need to when i find 1º bold that line.
Thanks for all your help
I have a cell with several lines, i would like to search for "1º", and when find bold that whole line.
I found a macro that finds a text and bold it: (But has a lot of uncessary stuff i don't need like input box and stuff., only need to find 1º and bold line )
Code:
Sub FindAndBold()'Updateby Extendoffice 20160711
Dim xFind As String
Dim xCell As Range
Dim xTxtRg As Range
Dim xCount As Long
Dim xLen As Integer
Dim xStart As Integer
Dim xRg As Range
Dim xTxt As String
On Error Resume Next
If ActiveWindow.RangeSelection.Count > 1 Then
xTxt = ActiveWindow.RangeSelection.AddressLocal
Else
xTxt = ActiveSheet.UsedRange.AddressLocal
End If
Set xRg = Application.InputBox("Please select data range:", "Kutools for Excel", xTxt, , , , , 8)
If xRg Is Nothing Then Exit Sub
On Error Resume Next
Set xTxtRg = Application.Intersect(xRg.SpecialCells(xlCellTypeConstants, xlTextValues), xRg)
If xTxtRg Is Nothing Then
MsgBox "There are no cells with text"
Exit Sub
End If
xFind = Trim(Application.InputBox("What do you want to BOLD?", "Kutools for Excel", , , , , , 2))
If xFind = "" Then
MsgBox "No text was listed", vbInformation, "Kutools for Excel"
Exit Sub
End If
xLen = Len(xFind)
For Each xCell In xTxtRg
xStart = InStr(xCell.Value, xFind)
Do While xStart > 0
xCell.Characters(xStart, xLen).font.Bold = True
xCount = xCount + 1
xStart = InStr(xStart + xLen, xCell.Value, xFind)
Loop
Next
If xCount > 0 Then
MsgBox "number of " & CStr(xCount) & " text be bolded!", vbInformation, "Kutools for Excel"
Else
MsgBox "Not find the specific text!", vbInformation, "Kutools for Excel"
End If
End Sub
My Cell A1 is like this:
3º ABC
2º ABB
1º ACCC
5º ASDASD
5º ASDAS
6º ASDA
Essential what i need to when i find 1º bold that line.
Thanks for all your help