Range object is the one of the most frequently used object while automating any task with VBA. We refer different Ranges in Excel Worksheets and perform various operation on Excel Ranges. We have different Properties, Methods to deal with Excel Worksheet Range Objects. Here you can find a brief explanation about each on most useful Properties and Methods while automation any tasks.
Our objective of building this Excel VBA Explorer is to provide suitable examples on most frequently used methods and properties of Range object. So that you can quickly find the solution, syntax whenever you required it.
Represents one or more cells of the worksheet. We can refer rows, columns, or selection of cells
'Refers the Range A1:B10 Set rng=Rows("A1:B10") 'Refers the Rows 2 to 5 Set rng=Rows("2:5") 'Refers the Columns 2 /Column B Set rng=Columns(2)
Range methods helps us to perform different actions with Excel ranges. For example, we can copy a range and paste into different location. And we can insert or delete rows or columns. And we can also clear the ranges, format the ranges.
Excel VBA Range Object Methods:
- Activate: To activate required Range in Excel Worksheet
- AddComment: To add Comments in Excel Ranges
- AdvancedFilter: To apply advanced filters on Excel Range
- Calculate: To refresh the calculations in a Range
- Clear: To clear an Excel Range completely including formats and data
- ClearComments: To clear only the comments in particular Range
- ClearContents: To clear only the contents/data in a range
- ClearFormats: To clear only the formats of an Excel range
- ClearHyperlinks: To clear only the hyperlinks in a Range
- Copy: To copy a range to another location
- CopyFromRecordset: Copy the data from recordset and paste in a Range
- Cut: To cut a Range in Worksheeet
- Delete: To delete a Range in Worksheet
- Find: To search and find a cell with required data
- Insert: To insert a range of Cells, Rows or Columns
- ListNames: To list the named ranges in the workbook
- Merge: To merge the Range of Cells
- PasteSpecial: To paste the data with different criterias, like values, formats with mathematical operations or transpose
Properties of Range object will helps us to deal with various properties of Excel Ranges. For example, we can enter data into a range, read the data from a range, we can change the formats of the range like font color, fill color, borders.
More Explanation and Examples on Properties of Range Object will be available soon.
Leave A Comment