The Set keyword

As the last example in Table 5.2 shows, the difference between assigning a value to an object variable and a non-object variable is that the object assignment must begin with the keyword Set. The remainder of the syntax is identical to that when declaring a non-object variable. For example, the following two lines of VBA code declare a variable called this_month_sales as a Range object, and define it with the keyword Set.

Dim this_month_sales As Range

Set this_month_sales = Range ("month_sales")

The above two lines will assign the range variable this_month_sales to the range variable month_sales.

Write two lines of code that will assign the chart variable my_new_chart to the chart variable my_chart.

0 0

Post a comment