VB Macro for cell colour default
Another one:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myValRng As Range
Dim myCell As Range
Dim myRngToCheck As Range
Dim myInterSect As Range
Dim res As Variant
Set myValRng = Me.Range("a10:g10")
Set myRngToCheck = Me.Range("a1:g9")
Set myInterSect = Intersect(Target, myRngToCheck)
If myInterSect Is Nothing Then Exit Sub
For Each myCell In myInterSect.Cells
res = Application.Match(myCell.Value, myValRng, 0)
If IsError(res) Then
myCell.Interior.ColorIndex = xlNone
Else
myCell.Interior.ColorIndex = 20
End If
Next myCell
End Sub
KCG wrote:
Hello there,
I have used up all conditional formatting. Please help me with developing a
Macro for further cell formatting as follows:
I have this range of numbers in the row A10:G10
12 5 26 3 17 38 9 23
If any number in this list is in the range A1:G9, I need the macro to colour
that found value's cell, blue.
Thanx for your help.
Regards
--
KCG
--
Dave Peterson
|