Question: Sub HighlightRows ( ) Dim nr As Integer, i As Integer, ID As String, Identifier As String, Key As Integer nr = WorksheetFunction.CountA ( Columns

Sub HighlightRows()
Dim nr As Integer, i As Integer, ID As String, Identifier As String, Key As Integer
nr = WorksheetFunction.CountA(Columns("A:A"))-2
Identifier = Left(ID,1)
Key = Left(Mid(ID,4,4),1)
For i =1 To nr
If range("A" & i +1)= range("Identifier") And range("A" & i +1)= range("Key") Then
range("A :C" & i +1).Interior.ColorIndex =4
range("B" & i +1).Interior.ColorIndex =4
range("C" & i +1).Interior.ColorIndex =4
End If
Next i
End Sub
This1) When a match is found in a row, all three columns of data (columns A, B, and C) must be highlighted green.
2) "Green" refers to the interior color index equal to 4. For example, Range("A1").Interior.ColorIndex =4 would color cell A1 green. The grader file is specifically looking for this ColorIndex! If you color the cells a different shade of green, it won't pass the grader!
3) When additional rows are added to the data (for example, in row 27 and beyond), your sub should automatically detect the size of data (number of rows) and adjust accordingly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!