Panda
06-14-2010, 03:45 AM
Hi There,
I have a spreadsheet containing a list of part numbers in column A (see attached) and I am trying to use VBA to condionally format the whole row if either 77154696 or 77156375 is present within column A. I know that this can be done with the conditonal format function, but this is proving to be tempremental and only working on the odd occasion.
I have managed to get some code that will highlight the cell in column A containaing either of the aforementioned part numbers but can work out how to modify the code to the the row highlighted.
Does anyone have any ideas?
The code I have got so far is;
Sub Check_Range_Value()
Dim rnArea As Range
Dim rnCell As Range
Sheets("Data").Select
Set rnArea = Range("A1:I10000")
For Each rnCell In rnArea
With rnCell
If Not IsError(.Value) Then
Select Case .Value
Case "77154696"
.Interior.ColorIndex = 35
Case "77156375"
.Interior.ColorIndex = 36
End Select
End If
End With
Next
End Sub
Thanks
I have a spreadsheet containing a list of part numbers in column A (see attached) and I am trying to use VBA to condionally format the whole row if either 77154696 or 77156375 is present within column A. I know that this can be done with the conditonal format function, but this is proving to be tempremental and only working on the odd occasion.
I have managed to get some code that will highlight the cell in column A containaing either of the aforementioned part numbers but can work out how to modify the code to the the row highlighted.
Does anyone have any ideas?
The code I have got so far is;
Sub Check_Range_Value()
Dim rnArea As Range
Dim rnCell As Range
Sheets("Data").Select
Set rnArea = Range("A1:I10000")
For Each rnCell In rnArea
With rnCell
If Not IsError(.Value) Then
Select Case .Value
Case "77154696"
.Interior.ColorIndex = 35
Case "77156375"
.Interior.ColorIndex = 36
End Select
End If
End With
Next
End Sub
Thanks