Fill D1:D4 format all the way below

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,364
Office Version
  1. 2010
Hello,

Here is original data


Book1
CDE
1A - A
2A - B
3C - A
4C - C
5
6C - A
7C - C
8C - A
9A - A
10A - B
11C - A
12C - A
13A - B
14A - A
15A - B
16C - A
17A - A
18A - A
19C - A
20A - A
21A - A
22A - A
23A - A
24C - A
25A - A
26C - A
27C - C
28A - B
29C - C
30C - C
31A - A
32
Hoja1


I want to fill D1:D4 format as per text find all the way below D6 to end of the column

Example after i want it looks like as below


Book1
CDE
1A - A
2A - B
3C - A
4C - C
5
6C - A
7C - C
8C - A
9A - A
10A - B
11C - A
12C - A
13A - B
14A - A
15A - B
16C - A
17A - A
18A - A
19C - A
20A - A
21A - A
22A - A
23A - A
24C - A
25A - A
26C - A
27C - C
28A - B
29C - C
30C - C
31A - A
32
Hoja2


Thank you all

Excel 2000
Regards,
Moti
 
You are welcome.

The "C - C" font color was black (automatic) on my test sheet,
but here is a modified version that explicitly sets the font color to black:
Code:
Sub ColorCell()
    For Each cll In Range("D1:D" & Range("D" & Rows.Count).End(xlUp).Row)
        With cll
            .Font.Color = vbBlack
            Select Case .Value
                Case "A - A": .Interior.Color = vbGreen
                Case "C - C": .Interior.Color = vbRed
                Case "A - B": .Interior.Color = vbGreen
                    .Characters(Start:=5, Length:=1).Font.Color = vbRed
                Case "C - A": .Interior.Color = vbRed
                    .Characters(Start:=1, Length:=1).Font.Color = vbWhite
                    .Characters(Start:=5, Length:=1).Font.Color = vbGreen
            End Select
        End With
    Next cll
End Sub
Tetra201, all is working fine!!

Thank you for your help

Regards,
Moti
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,215,580
Messages
6,125,654
Members
449,245
Latest member
PatrickL

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top