Format text in all Cells that contain a specific Word. Bold / Italics / Cell Colour
Posted on 2011-04-20
I have a macro which i came across a few months ago, which i have altered to do what i wanted it to do....
Namely, a userform is launched from a menu drop down item.
On this userform is the following macro, which will look for the text specified in the textbox and make all words specified bold
This is the macro:
Dim iLoop As Integer
Dim rNa As Range
Dim i As Integer
Dim FindIt As String
'Userform textbox where the specific word is entered and searched for
FindIt = BoldForm.txtSearch.Value
iLoop = WorksheetFunction.CountIf(Columns(1), FindIt)
Set rNa = Range("A1")
For i = 1 To iLoop
Set rNa = Columns(1).Find(What:=FindIt, After:=rNa, LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True)
'make the specific word bold
rNa.Font.Bold = True
I used the same macro, but changed the options, so that it would format text in Bold, Italics and even colour text or colour cells with specific text.
My problem, is that it will only work on text found in Column A.
I have tried several ways of chopping up the code to get it to work across all columns and all rows, but my knowledge or lack there of, fails me everytime.
Can anyone please help me amend the macro so that it will look at all columns and rows for the specific text entered in the Userform textbox.