Manipulating Worksheet Contents
You have already seen some examples of manipulating worksheet contents. For the most part, the manipulations consist of either putting something into worksheet cells or reading something out of worksheet cells. The Range object's Value property is used to both set and read cell data. For example, the statement
SomeRange.Value = data
puts data in the specified range. If SomeRange refers to more than one cell, then data is put into each of the cells in the range. Existing data is overwritten without warning. Data can be a number, text, a formula, or one of Excel's built in functions. Following are some examples:
Range("A1").Value = 1234.56 Range("A2").Value = "Sales data" Range("A3").Value = "=A1/2" Range("B11").Value ...
Get Office® XP Development with VBA now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.