I'm trying to figure out when to use quotes when using a range variable and when not to. It has something to do with vba range and vba range object.
Below are two sets of code, one produces an error while the other does not.
In my examples RngInsertRow has been declared as a range.
The following produces an error on the second line.
CODE
Set RngInsertRow = headerRow.Offset(1, 0)
Range("RngInsertRow").EntireRow.Insert Shift:=xlShiftDown, CopyOrigin:=xlFormatFromRightOrBelow
END CODE
On the next two lines, the alternate does not produce an error.
CODE
Set RngInsertRow = headerRow.Offset(1, 0)
RngInsertRow.EntireRow.Insert Shift:=xlShiftDown, CopyOrigin:=xlFormatFromRightOrBelow
END CODE
Please explain in detail and if anyone can supply further examples that might be helpful. TIA