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.
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.
To Select Row of an ActiveCell
ReplyDeleteActiveCell.EntireRow.Select