I am struggling with most probably a straight forward problem, but here goes. I want to write some VB coding to match cell values to a list I have already made "Stock" so that only rows with the values that don't match get highlighted in red. My problem is being able to reference the list "Stock" in VB - is it possible?
Sheet 1 contains my named ranges, and sheet 2 is where data gets entered. So basically is there any way to say if Activecell is found in named range then color no fill, if not color red.
Thanks in advance. I'm sure it's not as simple as I'm trying to make it. Eventually it might build to names and not just numbers that I'm looking up as well.
Sub ValTest()
Dim numOfRecs As Integer
ActiveWorkbook.Names.Add Name:="Office", RefersTo:="Sheet1!$A$2:$A$25"
'---------------------
'Start - Validate Office
'---------------------
Sheet2.Activate
Range("A2").Select
numOfRecs = 0
Do Until ActiveCell.Value = ""
' Validate Office
If ActiveCell.Value = ??????? Then
ActiveCell.Interior.ColorIndex = 3 'Red
Else
ActiveCell.Interior.ColorIndex = 0 'No Fill
End If
numOfRecs = numOfRecs + 1
ActiveCell.Offset(1, 0).Select
Loop
' Go to first cell.
Range("A1").Select
End Sub
Bookmarks