Here is my excel data
I am trying to find the cell data in row 1 and 2
arrCols = Array("APPLE", "ORANGE") With Sheet1 For i = LBound(arrCols) To UBound(arrCols) Set colHeader = .Rows(1).Find(arrCols(i), , xlValues, xlWhole, xlByColumns, xlNext, False) Debug.Print arrCols(i) & "=" & colHeader.Address Set colDiff = .Rows(2).Find("test", , xlValues, xlWhole, xlByColumns, xlNext, False) Debug.Print "test =" & colDiff.Address Next End With
This is the current output
APPLE=$A$1 test =$D$2 ORANGE=$D$1 test =$D$2
As you can see, in row 2, Excel is not finding the first occurrence of searched data. What am I doing wrong and how do I get the first "test" address?
APPLE=$A$1 test =$A$2 ORANGE=$D$1 test =$D$2