0

When trying to define a range in an external workbook, sometimes Range() doesn't accept taking Cells() as an argument e.g. Set range = Workbooks("<Workbook>").Sheets("<Worksheet>").Range(Cells(1,2), Cells(3,2), and I get the following error:

Run-time error '1004' Application-defined or object-defined error

however, this error is gone if I set the range using Range("B1:B3"), instead.

So, what are the possible causes of this issue?

Diaa
  • 135
  • 1
  • 10
  • In your example, `Cells` is not qualified, so they refer to the Active Sheet, not the sheet you are using prior to that. It does not automatically assume you mean the same sheet, and since the ranges on the active sheet are not based on the same sheet, you get an error. – braX Jun 24 '22 at 09:47
  • @braX Thanks for the explanation. So, is there any way to use the row and column numbers inside range? – Diaa Jun 24 '22 at 09:48

0 Answers0