0

I have a code written to create a table copying information from various spreadsheets which use a common template. I'm facing a weird issue where Range().Value is returning the correct value, but the Worksheets.Range.Value is returning something completely way off!

code & watch window

I don't know where this value is coming from. In fact this value does not exist in the entire workbook either. I'm clueless. If someone can please throw some light!

I tried to run the code line by line, but there are two different values appearing on the watch for the same exact line of code.

GSerg
  • 76,472
  • 17
  • 159
  • 346
  • 1
    It's the other way round. Worksheets.Range.Value is the correct value, and Range.Value is not. You have selected the subexpression `Range(...).Value` in the IDE, thus forcing it to evaluate it as a standalone expression. So it did, throwing away the preceding `Worksheets(i).` that qualifies the range, turning it into `ActiveSheet.Range(...).Value`. – GSerg Apr 22 '23 at 14:16

0 Answers0