Display a red X if Range contains the same

Donal28

Well-known Member
Joined
Apr 23, 2010
Messages
527
Hi All

I'm looking for a formula that will place a red x in a cell if a certain range contains a red x. The range is L8:L15 and the cell I would like to display the red X in is AD6.

Any help on this would be very much appreciated

Regards

Donal
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Maybe somthing like this?

Code:
Sub foo()
Set Rng = ActiveSheet.Range("L8:L15")
    With Range("AD6")
        .Value = ""
        .Font.ColorIndex = xlAutomatic
    End With
For Each c In Rng
    If c.Value = "x" Then
        If c.Font.Color = vbRed Then
            With Range("AD6")
                .Value = "x"
                .Font.ColorIndex = 3
            End With
        End If
    End If
Next c
End Sub
 
Upvote 0
Maybe somthing like this?

Code:
Sub foo()
Set Rng = ActiveSheet.Range("L8:L15")
    With Range("AD6")
        .Value = ""
        .Font.ColorIndex = xlAutomatic
    End With
For Each c In Rng
    If c.Value = "x" Then
        If c.Font.Color = vbRed Then
            With Range("AD6")
                .Value = "x"
                .Font.ColorIndex = 3
            End With
        End If
    End If
Next c
End Sub


Thanks for the reply Jim, I have tried this code but nothing happens, maybe I'm not implementing the macro properly.....I hit ALT and F11 and entered the code but nothing happens when a red x is entred in the range L8:L15. Do I need to attach the code toa button or something?
 
Upvote 0
Did you paste the code into a Standard Module (say like Module1)?

Currently, you need to run "Foo" AFTER you make any changes to your range(L8:L15).
So make a change in L8:L15 then Run Foo.

A Forms-type button could also be placed on your worksheet to run Foo.
 
Upvote 0
If the red X in L8:L15 got that way via Conditional Formatting, it would be easier to detect the condition that caused the redness than it is to test if the cell is red.
 
Upvote 0
Did you paste the code into a Standard Module (say like Module1)?

Currently, you need to run "Foo" AFTER you make any changes to your range(L8:L15).
So make a change in L8:L15 then Run Foo.

A Forms-type button could also be placed on your worksheet to run Foo.

Yess thats worked alright...thanks so much for your help ;)
 
Upvote 0
Mikerickson is right... I presently HAVE NOT considered that you have activated any conditional formatting...
 
Upvote 0
If the red X in L8:L15 got that way via Conditional Formatting, it would be easier to detect the condition that caused the redness than it is to test if the cell is red.

Thanks for the reply but the red Xs aren't a result of conditioning formatting
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,813
Members
452,945
Latest member
Bib195

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