Be the first user to complete this post

  • 0
Add to List

VBA Excel - Cells, Ranges and Offset : Offset

Offset:

  • Offset property in VBA-Excel is used along with Range.
  • With the help of Offset property user can move around in the sheet.

Format:

Range(“StartingPoint”).Offset(NoOfRowsToBeMoved , NoOfColumnsToBeMoved)

Example :

Range(“A2”).Offset(1,0).Select

And compiler reads, move one cell down from A2 , which is A3.

Range(“A2”).Offset(-1,0).Select

And compiler reads, move one cell Up from A2 , which is A1.

Range(“A2”).Offset(1,1).Select

And compiler reads, move one cell down and one cell right from A2 , which is B3.

ActiveCell.Offset(1,1)

And compiler reads, move one cell down and one cell right from the selected cell.



Also Read:

  1. VBA-Excel: Date-Time Functions – DateSerial()
  2. VBA-Excel: Copy/Paste data - Copy the Entire row data and paste it to another row
  3. VBA-Excel: Arrays – One Dimension, Dynamic Array
  4. VBA-Excel : Strings Functions – InstrRev
  5. VBA-Excel: Application.Wait OR Wait Method
  6. VBA-Excel: Date-Time Functions – DateDiff()
  7. Message Boxes in VBA Excel (Msgbox)
  8. VBA-Excel : Strings Functions – Instr