Hello, I need some assistance, my code isn't working. I need to create a subroutine that allows the user to select the Identifier from a drop-down menu in cell F2 and the Key from a drop-down menu in cell F3 and any rows of the data (columns A, B, and C) whose Batch ID meets those criteria will be highlighted GREEN. Thank you so much for your assistance.
Sub HighlightRows()
Dim nr As Integer, I As Integer
Dim ID As String, Key As Integer
Dim ws As Worksheet
Dim rng As Range
Set ws = ThisWorkbook.Sheets("Data")
nr = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
For I = 2 To nr
ID = ws.Cells(I, 1).Value
Key = ws.Cells(I, 3).Value (I get an error return error 6, overflow)
If ID = ws.Range("F2").Value And Key = ws.Range("F3").Value Then
Set rng = ws.Range("A" & I & ":C" & I)
rng.Interior.Color = RGB(0, 255, 0)
End If
Next I
End Sub
Sub HighlightRows()
Dim nr As Integer, I As Integer
Dim ID As String, Key As Integer
Dim ws As Worksheet
Dim rng As Range
Set ws = ThisWorkbook.Sheets("Data")
nr = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
For I = 2 To nr
ID = ws.Cells(I, 1).Value
Key = ws.Cells(I, 3).Value (I get an error return error 6, overflow)
If ID = ws.Range("F2").Value And Key = ws.Range("F3").Value Then
Set rng = ws.Range("A" & I & ":C" & I)
rng.Interior.Color = RGB(0, 255, 0)
End If
Next I
End Sub