Читать книгу Excel 2019 Power Programming with VBA - Michael Alexander, Dick Kusleika - Страница 118
Getting information from a cell
ОглавлениеIf you need to get the contents of a cell, VBA provides several properties. The following are the most commonly used properties:
The Formula property returns the formula in a single cell, if the cell has one. If the cell doesn't contain a formula, it returns the value in the cell. The Formula property is a read/write property. Variations on this property include FormulaR1C1, FormulaLocal, and FormulaArray. (Consult the Help system for details.)
The Value property returns the raw, unformatted value in the cell. This property is a read/write property.
The Text property returns the text that is displayed in the cell. If the cell contains a numeric value, this property includes all the formatting, such as commas and currency symbols. The Text property is a read-only property.
The Value2 property is just like the Value property, except that it doesn't use the Date and Currency data types. Rather, this property converts Date and Currency data types to Variants containing Doubles. If a cell contains the date 5/1/2019, the Value property returns it as a Date, while the Value2 property returns it as a double (for example, 43586).