0

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

End Subenter image description here

`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)** (NOT WORKING)

  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`
braX
  • 11,506
  • 5
  • 20
  • 33
Minmei
  • 1

0 Answers0