เอกสาร HotXLS

ออฟเซ็ตช่วง

วิธีทั่วไปในการทำงานกับช่วงที่สัมพันธ์กับช่วงอื่นคือการใช้คุณสมบัติ Offset

ตัวอย่าง

ตัวอย่างนี้แสดงวิธีใช้ Offset เพื่อทำงานกับช่วงที่สัมพันธ์กัน
Workbook.ActiveSheet.Selection.Offset[2, 3].Font.Underline := xlDouble;
The following example makes the copy of range B5:G7 under it
With Workbook.Sheets[1].Range['B5','G7'] do begin
   Offset[Rows.Count, 0].Insert(xlShiftDown);
   Copy(Offset[Rows.Count, 0], xlPasteAll);
end;