Monday 20 May 2013

How to Select Entire Row/Column in Excel VBA Macro

Example - We can select entire row or column  vey easily using below code.

Code and Syntax :

To Select Entire Row No 2 -
 Workbooks("Book1").Sheets("Sheet1").Range("2:2").Font.Bold = True

To Select Entire Column A -
 Workbooks("Book1").Sheets("Sheet1").Range("A:A").Font.Bold = True

To Select Cell A1 -
 Workbooks("Book1").Sheets("Sheet1").Range("A1").Font.Bold = True

To Select Cell Range -
 Workbooks("Book1").Sheets("Sheet1").Range("A1:B8").Font.Bold = True

To Select Multiple Cell Range -
Workbooks("Book1").Sheets("Sheet1").Range("A1:B8,G3:I9").Font.Bold = True

To Select Multiple Columns sequentially -
 Workbooks("Book1").Sheets("Sheet1").Range("A:C").Font.Bold = True

To Select Multiple Columns Not sequentially -
 Workbooks("Book1").Sheets("Sheet1").Range("A:A,C:C").Font.Bold = True
'Here Columns A and C will be selected.

So This is how we can do selections in VBA Excel Macros.

 

1 comment:

  1. To Select Row of an ActiveCell

    ActiveCell.EntireRow.Select

    ReplyDelete

Popular Posts

Search This Blog