Be the first user to complete this post

  • 0
Add to List

VBA Excel - Cells, Ranges and Offset: Refer to Cells by Using Shortcut Notation

You don’t have to type Range every time, you have shortcut for that, ‘Brackets’.

Shortcut for referring one cell.

Worksheets("Sheet1").[G5].Interior.ColorIndex = 45

Instead of using Range(“G5”), you can use [G5].

Shortcut for referring range of cells.

Worksheets("Sheet1").[E3:F5].Value = 4

Instead of using Range(“E3:F5”), you can use [E3:F5].

Shortcut for referring more than one cell.

Worksheets("Sheet1").[G5,F9,H6].Interior.ColorIndex = 45

Instead of using Range(“G5”,”F9”,”H6”), you can use [G5,F9,H6].

Also Read:

  1. VBA-Excel: Arrays – Two Dimensional, Static Array
  2. How to Enable Macro in Excel
  3. Message Boxes in VBA Excel (Msgbox)
  4. VBA-Excel: Delete Blank Rows from Excel Work Sheet
  5. VBA-Excel: Clear data from Excel Sheet(WorkSheet)
  6. VBA-Excel: Date-Time Functions – DateDiff()
  7. VBA-Excel: String Functions – strComp()
  8. VBA-Excel: Get the names of all WorkSheets in a Excel (WorkBook)