• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro for Highlight cell with two condition

vivamz

New Member
Hi All,

Hope you guys are doing great !

I want Column B to highlighted in RED, If Column B is "iPhone" and Column C is "Used". I am attaching the sample file.

Please give me coding for this.

Thank you so much in advance.
 

Attachments

  • VBA.xlsx
    8.3 KB · Views: 8
Hi,​
according to your attachment a VBA beginner starter demonstration to paste to the Sheet1 worksheet module :​
Code:
Sub Demo1()
           Dim Rg As Range, R&
        Application.ScreenUpdating = False
    With Me.UsedRange.Columns(2)
           .Font.ColorIndex = xlAutomatic
           Set Rg = .Find("iPhone")
        If Not Rg Is Nothing Then
                   R = Rg.Row
            Do
                    If Rg(1, 2).Value2 = "Used" Then Rg.Font.Color = vbRed
                   Set Rg = .FindNext(Rg)
            Loop Until Rg.Row = R
                   Set Rg = Nothing
        End If
    End With
        Application.ScreenUpdating = True
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
As it rocks on my side, you just missed to well read my previous post, in particular the dark red direction !​
Tip for bad readers : replace Me keyword - a VBA help must see ! - with any other valid worksheet reference …​
 
Back
Top