Reputation: 5
I'm using the below code to find the Match
function in VBA to find a transaction id in a column:
findrow = Application.WorksheetFunction.Match(cell, _
ActiveWorkbook.Sheets(temp_import).Range("B:B"), 0)
The transaction id (cell) I'm looking for is on 63,000th
row. I'm wondering if I have defined the variable findrow
incorrectly and this is preventing the match function from working? I have defined findrow
as an integer.
Any pointers greatly appreciated.
Upvotes: 0
Views: 75
Reputation: 149287
Define it as Long
. xl2007+ supports 1048576 rows.
See this. This will give you an error.
Sub Sample()
Dim i As Integer
i = 63000
End Sub
Now try this
Sub Sample()
Dim i As Long
i = 63000
End Sub
And since you are using Match
, either use error handling or define the variable as Variant
If you search stackoverflow, many posts have been covered on how to handle Match in VBA.
Upvotes: 1