Is the . necessary in this Range object definition when both the Range.Cells properties inherit the Range.Parent worksheet property that is defined within the With ... End With statement?
How can this,
dim g as range
with thisworkbook '<~~ possibly set an exteal workbook
with .worksheets("sheet1")
' define g as Sheet1!A2 to the last populated cell in Sheet1!A:A
set g = .range(.cells(2, 1), .cells(rows.count, 1).end(xlup)) '<~~ .range
end with
end with
debug.print g.address(0, 0, exteal:=true)
... be different from this,
dim g as range
with thisworkbook '<~~ possibly set an exteal workbook
with .worksheets("sheet1")
' define g as Sheet1!A2 to the last populated cell in Sheet1!A:A
set g = range(.cells(2, 1), .cells(rows.count, 1).end(xlup)) '<~~ range not .range
end with
end with
debug.print g.address(0, 0, exteal:=true)
We use .range when the parameters that define the scope of the range are ambiguous; e.g. .range("A1") The A1 cell could be from any worksheet and will default to the ActiveSheet property without the .. But why do we need to reference the parent of a range object when the scope that defines it has properly referenced its parent worksheet?
