Wakelin Solutionz Pty Ltd

SPECIALISTS IN PERSONAL & ORGANISATIONAL PRODUCTIVITY

Phone: +61 421 551 254      Email:  wakelinsolutionz@bigpond.com

 

 
 
 
 
 
 
 

 

 

Code used to select cells, rows, columns or a range of data

 

The following code examples can be used to select an individual cell, or a range of cells, rows or columns

 

- Range("A1").Select

This puts the cursor into cell A1 of the current worksheet

 

- Range("A1").CurrentRegion.Select

This works on continuous data and selects all the way to the right and down

 

- Columns("C:E, G:H").Select

Selects columns C, D, E, G and H

 

- Rows("1:3, 5:6").Select

Selects rows 1, 2, 3, 5 and 6

 

- Range("A1", Range("A1").End(xlDown)).Select

Selects from cell A1 down to the last cell in a continuous block.  Also available are xlUp, xlToLeft and xlToRight

 

- ActiveCell.Select

Selects the cell the cursor is currently sitting in

 

- ActiveCell.End(xlDown).Select

Moves the cursor down to the last cell in a block of continuous data

 

- Range(ActiveCell, ActiveCell.End(xlDown)).Select

Selects from the current cell down to the last cell in a continuous block of data

 

- ActiveCell.Offset(1,3).Select

This moves the cursor one cell down and three cells to the right, from where the cursor currently is.  To move the cursor up or to the left, use negative numbers

 

- Range("A1", Range("A1").SpecialCells(xlCellTypeLastCell)).Select

This selects from cell A1 through to the last used cell in the worksheet. 

 

 

VBA Tips Index

 

Mob: 0421 551 254 Email Us