I have a problem with the .Match function. If I set a range inside it with quotes and letters ("A:A") it goes well. But when I try to set it with variable, it gives a 1004 error.
This works:
a = WorksheetFunction.Match(Range("A1"), Sheets("Data").Range("A:A"), 0)
This doesn't work:
a = WorksheetFunction.Match(Range("A2"), Sheets("Data").Range(Cells(a, 4), Cells(a + 5, 4)), 0)
How do I set a range with variables in a .Match function?