I'm getting a runtime error (9) Subscript out of range when trying to use Cells.Find Function.
According to the official documentation, there's only few possible causes:
- referenced a nonexistent array element
- declared an array but didn't specify the number of elements
- referenced a nonexistent collection member
- use the ! operator with a collection, the ! implicitly specifies a key
Here's some of the code that seems relevant to me, maybe someone has an idea:
Dim Partner As Worksheet
Dim rangePartner As Range
Set Partner = Worksheets("Partner")
Set rangePartner = Range(Partner.Cells(2, 2), Partner.Cells(2, 2).End(xlDown))
Dim partnerid As String
Dim segment As String
With rangePartner
segment = Cells.Find(partnerid, LookIn:=Values, SearchOrder:=xlByRows).Offset(0, 3)
End With
Also, if s.o. can give me a hint how to avoid Offset method in combination with Find function, feel free to shoot. :)
Was looking through forums and the official documentation to rule out causes. Checked assignments and spellings a 1000 times but cannot get behind what's going wrong...
Also, I excluded the Offset method, to see if this results in a different error.