Giordano Bruno
Well-known Member
- Joined
- Jan 7, 2007
- Messages
- 1,341
Hi Everyone. When Worksheets("Item") is active, I can use either of the following code lines
Worksheets("Item").Range("TEST").Formula = Worksheets("Model").Range(Cells(101, 22), Cells(101, 34)).Formula
Worksheets("Item").Range("TEST").Formula = Worksheets("Model").Range("V100:AH100").Formula
and they both do the same thing, but when I add "R1C1", i.e.
Worksheets("Item").Range("TEST").FormulaR1C1 = Worksheets("Model").Range(Cells(101, 22), Cells(101, 34)).FormulaR1C1
Worksheets("Item").Range("TEST").FormulaR1C1 = Worksheets("Model").Range("V100:AH100").FormulaR1C1
the first line fails with the message "Application-defined or object-defined error, although the second line works perfectly.
Both lines run perfectly if Worksheets("Model") is the active sheet, but I don't want to change worksheets.
I can work around the problem, but I'm curious to know why there is ever a difference between Range(Cells(101, 22), Cells(101, 34)).FormulaR1C1 and Range("V100:AH100").FormulaR1C1
Worksheets("Item").Range("TEST").Formula = Worksheets("Model").Range(Cells(101, 22), Cells(101, 34)).Formula
Worksheets("Item").Range("TEST").Formula = Worksheets("Model").Range("V100:AH100").Formula
and they both do the same thing, but when I add "R1C1", i.e.
Worksheets("Item").Range("TEST").FormulaR1C1 = Worksheets("Model").Range(Cells(101, 22), Cells(101, 34)).FormulaR1C1
Worksheets("Item").Range("TEST").FormulaR1C1 = Worksheets("Model").Range("V100:AH100").FormulaR1C1
the first line fails with the message "Application-defined or object-defined error, although the second line works perfectly.
Both lines run perfectly if Worksheets("Model") is the active sheet, but I don't want to change worksheets.
I can work around the problem, but I'm curious to know why there is ever a difference between Range(Cells(101, 22), Cells(101, 34)).FormulaR1C1 and Range("V100:AH100").FormulaR1C1