Hello VB.net

I don't know if I am in the right thread; but it is most closer to my problem;

Currently I have no idea or a near code to solve the problem;

In excel, Developers tab, there is a Visual Basic Application;

What I'm trying to do is color a one cell in specific column (ex. Column E and G);

If Column E and G have a number "6" it will be colored as yellow.

Is there a way how I can do that? something like a module or?

Please help, I don't have a scratch to give/show just come up with idea;

or If a .bat (Batch File) can do this alone will be more helpful.

Thank you and God Bless;

-zelrick

Hello Sir ddanbe;

Yes, conditional formatting also a solution but it was not automated;

But have seen some of solution using VBA, here is some of code that can used:

Sub AutoFill()
For Each cell In Range("E4:E100")
If cell.Value = 6 And cell.Value <> "" Then
cell.Interior.ColorIndex = 6
End If
Next

but was looking if comparing with 2 or more columns;

the code I use only can search from E4 to E100;

I dunno how to compare E4 to E100 and G4 to G100:

Thank you and God Bless

-zelrick

First, in Excel one must always try to find a solution with the functionality build in, before resorting to VBA.
In VBA you could try:

Sub AutoFill()
    For Each Ecell In Range("E4:E100")
        If Ecell.Value = 6 And Ecell.Value <> "" Then
            If Ecell.Offset(0, 2).Value = 6 Then
                Ecell.Interior.ColorIndex = 6
                Ecell.Offset(0, 2).Interior.ColorIndex = 6
            End If
        End If
    Next
End Sub
This article has been dead for over six months. Start a new discussion instead.