Home > Software engineering >  Questions about VBA mapping function parameters
Questions about VBA mapping function parameters

Time:09-26

Chart. SetSourceData Source:=Range (RChart. Offset (2, 0), RChart. Offset (1, (CNum - 1))) like drawing functions of
Why can't SourceData is custom arrays or Dim AllElements As the Variant
And in the pivot table function

ActiveWorkbook. PivotCaches. Create (SourceType:=xlDatabase SourceData:=_

The SourceData here must be the Range is not the custom arrays or Dim AllElements As the Variant

Ace to give directions

CodePudding user response:

Ashamed of myself, after I sent, just discover oneself didn't install office on machine, use VBA nor used before this two methods,

There is a small suggestion, just put your problem description to tidy it up again, had better with some screenshots, so to a better understanding on the issue, but also not very familiar with the Internet, understand what I mean when you will be much easier,

CodePudding user response:

I think this is decided by the object itself!

Those "chart" object, it is only to source data from the worksheet, the type of data source for naturally "Range" type of object,
If you want to use variables, if the variable (variable type is the Range or the Variant) Range "value" is to meet the requirements of object, should be!
If the parameter value is a simple array, certainly not,

CodePudding user response:

You again SetSourceData \ definition, you can see
 Sub SetSourceData (Source As Range, [PlotBy]) 

The parameters of the type of Source is Range! What's the problem clearly!

CodePudding user response:

reference 1st floor bcrun response:
ashamed, is the building Lord sent, just discover oneself didn't install office on machine, use VBA nor used before this two methods,

There is a small suggestion, just put your problem description to tidy it up again, with some best screenshot shows, this to a better understanding on the issue, but also not very familiar with the Internet, understand what I mean when you will be much easier,


Moderator code below

Range (" A1 "). The Value=https://bbs.csdn.net/topics/10
Range (" B1 "). The Value=https://bbs.csdn.net/topics/4
Range (" C1 "). The Value=https://bbs.csdn.net/topics/5

The Set RChart=Range (H5)
ActiveSheet. Shapes. AddChart (xlPie, (RChart. Left + RChart. Width/2), RChart. Top, (RChart. Width * 3), (RChart. Height * 10)). Select

ActiveChart. SetSourceData Source:=Range (" $A $1: $C $1 ") //the problem is here I must set the value of the three Range see code seems to be in front of this parameter must be Range actually need only a three members of an integer array can be any other way directly using value (10, four, five) was introduced into the drawing function, three Range without messing up

ActiveChart. SeriesCollection (1). XValues="={" "primary ""," "intermediate" ", "" advanced" "} "
ActiveChart. SeriesCollection (1). The Name="=" "staff capacity distribution" ""
ActiveChart. SeriesCollection (1). Select
ActiveChart. SeriesCollection (1). ApplyDataLabels
ActiveChart. ChartTitle. Format. TextFrame2. TextRange. The Font. NameComplexScript="Microsoft jas black
"ActiveChart. ChartTitle. Format. TextFrame2. TextRange. The Font. NameFarEast="Microsoft jas black
"ActiveChart. ChartTitle. Format. TextFrame2. TextRange. The Font. The Name="Microsoft jas black
"ActiveChart. ChartTitle. Format. TextFrame2. TextRange. The Font, Size=10

CodePudding user response:

Already said very clearly: data sources must be in the Range object !

CodePudding user response:

Can't, you must first have the Range (fill good Cell),

So-called external data sources is to store data, Excel charts themselves don't save the data, when we need to display take the data source's data to draw graphics,
If there is no fill good Cell, if support other data sources such as an array; Then save the file, open, next time when draw chart where the access?
  •  Tags:  
  • VBA
  • Related