Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Bạn có thể sử dụng tài sản Offset của đối tượng Range để đề cập đến phạm vi trên một bảng tính dựa trên, hoặc liên quan đến một phạm vi. Tài sản này cung cấp cho bạn rất nhiều tính linh hoạt cho di chuyển xung quanh một bảng tính. Bù đắp là cho Navigation tương đối | chart manipulation 225 With chrt use chart wizard to populate format empty chart .Chartwizard _ Source rgChartData _ Gallery xlColumn _ Format 1 _ PlotBy xlColumns _ CategoryLabels 1 _ SeriesLabels 1 _ HasLegend True _ Title Gross Domestic Product Version I _ CategoryTitle Year _ ValueTitle GDP in billions of End With Set chrt Nothing Set rgChartData Nothing Set ws Nothing End Sub You probably already know this but a chart can assume two forms it can be created as a chart sheet or it can be embedded within a worksheet. One thing that is kind of odd regarding the process of creating a chart is that you don t have any control over what kind of chart is created when you use Charts.Add. This statement creates an empty chart sheet. This is fine and dandy if you want a chart sheet but what if you want to embed it into a worksheet That is what the Location method is for. YourChartObject.Location Where Name The Where parameter can be either xlLocationNewSheet creates a chart sheet xlLocationAsObject embeds in a worksheet or xlLocationAutomatic. The Name parameter is the name of the new chart sheet if you use xlLocationNewSheet. If you use xlLocationAsObject the Name parameter should be the name of the worksheet in which you want to embed the chart. Another somewhat peculiar aspect of creating a chart is that Location creates a new Chart object from a programmatic perspective. If you are using a Chart object variable to refer to a chart you need to reset it when you use Location. That s the reason for the following statement in the CreateExampleChartVersionI procedure. embed chart in worksheet - this creates a new object Set chrt chrt.Location xlLocationAsObject ws.Name Now that you have the chart where you want it it is time to employ the ChartWizard method to give the chart some personality. As you can see in this example the ChartWizard method has a lot of parameters and you ll probably use most of them. Note however that all of the parameters are optional. .