Replacing value based on cell color

Nanditha

New Member
Joined
May 28, 2021
Messages
10
Office Version
  1. 2013
Platform
  1. Windows
Hi All,
I am looking for your help in the below scenario.

i am trying to replace values in column A if the font colour is green and it has a text “Expiring”. These should be replaced with cell value “Issued” and interior colour should be Amber.

Below is the code I have used. Can you please let me know if there is an error? I am not getting the result once the code is executed.

code attached in the image.
 

Attachments

  • 25C6D5C1-13DB-44CD-B269-32FE8CFA91B5.jpeg
    25C6D5C1-13DB-44CD-B269-32FE8CFA91B5.jpeg
    28.8 KB · Views: 20

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
It might help if you actually post the code rather than a picture of same....most posters wont want to rewrite the code to test it.
 
Upvote 0
Sure. Here is the code

Dim Cl As Range

With Sheets(“CC5”)
For Each Cl In .Range(“A3”, .Range(“A” & rows.count).End(xlUp)
If Cl.cells.value = “Expiring” And Cl.font.color = -11489280 Then
Cl.cells.value = “Issued” And Cl.interior.color = 49407
End If
 
Upvote 0
Maybe this
Make sure that the font color references are correct
VBA Code:
Sub MM1()
Dim Cl As Range
With Sheets("CC5")
    For Each Cl In .Range("A3", .Range("A" & Rows.Count).End(xlUp))
        If Cl.Value = "Expiring" And Cl.Font.Color = -11489280 Then
            Cl.Value = "Issued" And Cl.Interior.Color = 49407
        End If
    Next Cl
End With
End Sub
 
Upvote 0
Solution
Maybe this
Make sure that the font color references are correct
VBA Code:
Sub MM1()
Dim Cl As Range
With Sheets("CC5")
    For Each Cl In .Range("A3", .Range("A" & Rows.Count).End(xlUp))
        If Cl.Value = "Expiring" And Cl.Font.Color = -11489280 Then
            Cl.Value = "Issued" And Cl.Interior.Color = 49407
        End If
    Next Cl
End With
End Sub
Thank you soo much. This worked
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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