E
Eric
Hello,
I have a problem writing a macro in my excel file, I want
to change the color of specific range and my data goes
like this:
Column1 Column2
Row 1: Filename ABC
Row 2: Desc ABC Company
..
..
..
Row 21: Filename DEF
Row 22: Desc DEF Enterprise
..
..
..
so on
I have to search for word "Filename" and if found, change
the "ABC" color to RED and go down change "ABC Company" to
Blue, and so on. Below is sample code, How could I do
this in loop (in Do While perhaps?) so that my code won't
be long.
Cells.Find(What:="Filename", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate
Range("B5").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 5
Range("B6").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 10
Range("B7").Select
Selection.Font.Bold = True
Range("B8").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
Cells.FindNext(After:=ActiveCell).Activate
Range("B75").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 5
Range("B76").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 10
Range("B77").Select
Selection.Font.Bold = True
Range("B78").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
Thanks everybody in advance for your help.
Eric
I have a problem writing a macro in my excel file, I want
to change the color of specific range and my data goes
like this:
Column1 Column2
Row 1: Filename ABC
Row 2: Desc ABC Company
..
..
..
Row 21: Filename DEF
Row 22: Desc DEF Enterprise
..
..
..
so on
I have to search for word "Filename" and if found, change
the "ABC" color to RED and go down change "ABC Company" to
Blue, and so on. Below is sample code, How could I do
this in loop (in Do While perhaps?) so that my code won't
be long.
Cells.Find(What:="Filename", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate
Range("B5").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 5
Range("B6").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 10
Range("B7").Select
Selection.Font.Bold = True
Range("B8").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
Cells.FindNext(After:=ActiveCell).Activate
Range("B75").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 5
Range("B76").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 10
Range("B77").Select
Selection.Font.Bold = True
Range("B78").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
Thanks everybody in advance for your help.
Eric