MO-211 practice question 25 of 35

What is the purpose of the Selection object in VBA?

Full set: 355 questions

Domain Insert and format text, shapes, and images

Answer options
A: To move the active cell in Excel
B: To highlight cells in Excel
C: To select a range of cells in Excel Correct answer
D: To create a new workbook in Excel
Correct Answer:
C. To select a range of cells in Excel
Explanation

The Selection object is a property of the Application object that returns the currently selected object in the active window. In an Excel worksheet, this is most commonly a Range object representing one or more cells. The primary purpose of the Selection object is to provide a programmatic way for VBA code to refer to and manipulate the cells, chart, or shape that a user has currently selected on the screen. While the wording of option C is an action ("To select"), it correctly identifies the core concept associated with the object: the selected range of cells.

Why Incorrect

A. The ActiveCell property, not the Selection object, is used to specifically refer to the single active cell within the current selection.
B. Highlighting is a formatting action (e.g., changing Interior.Color) that can be applied to the Selection object, but it is not the object's fundamental purpose.
D. Creating a new workbook is performed using the Workbooks.Add method, which is unrelated to the Selection object or any user selection on a worksheet.

References

1. Microsoft Corporation. (2023). Application.Selection Property (Excel). Microsoft Learn | Office VBA Reference. Retrieved from https://learn.microsoft.com/en-us/office/vba/api/excel.application.selection.

Reference Detail: The documentation states

"Returns the object that is currently selected in the active window." For a worksheet

it clarifies that the returned object type can be a Range

Chart

Shape

etc.

with Range being the most common. This supports that the object's purpose is to represent the selected range.

2. University of Reading. (n.d.). An Introduction to Visual Basic for Applications in Excel. Statistical Services Centre

p. 19.

Reference Detail: In the section on "Objects

Properties and Methods

" the document explains

"The current selection is itself an object

called Selection. So Selection.Font.Bold = True makes the current selection bold." This demonstrates that the Selection object's purpose is to represent the currently selected cells for manipulation.

Scroll to Top