我写了一段代码,可是我却加不进去图表位置设定。代码如下。希望实在这段代码加上去,能用。
y = [A1048576].End(xlUp).Row '画图
ActiveSheet.Range(Cells(3, b), Cells(y,b)).Select '定义Y轴区域
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceDataSource:=Union(Range(Cells(3, a), Cells(y, a)), Range(Cells(3, b), Cells(y, b)))
Setmychart = Sheet1.ChartObjects.Add(120, 40, 400, 250)
WithActiveChart
'.HasTitle = flase '为图表设置标题
' With .ChartTitle
' .Text = "??"
' .Font.Name = "宋体"
'.Font.Size = 15
'.Font.ColorIndex = 5
' .Top = 5
'.Left = 150
'End With
With .Axes(xlCategory) '为图表设置横坐标
.HasTitle = True
.AxisTitle.Text = TextBox1.Text
.AxisTitle.Font.Name = "Arial"
.AxisTitle.Font.Size = 9
.AxisTitle.Font.Bold = False
.AxisTitle.Font.ColorIndex = 1
.MinimumScale = TextBox5.Text
.MaximumScale = TextBox3.Text
.MajorUnit = 500
End With
With .Axes(xlValue) '为图表设置纵坐标
.HasTitle = True
.AxisTitle.Text = TextBox2.Text
.AxisTitle.Font.Name = "Arial"
.AxisTitle.Font.Size = 9
.AxisTitle.Font.Bold = False
.AxisTitle.Font.ColorIndex = 1
.MinimumScale = TextBox6.Text
.MaximumScale = TextBox4.Text
.MajorUnit = 0.02
End With
VBA设置图表位置
答案:2 悬赏:40
解决时间 2021-12-21 17:43
- 提问者网友:故事与他
- 2021-12-21 10:52
最佳答案
- 二级知识专家网友:疯山鬼
- 2021-12-21 12:26
这个能把具体的发给我吗,我做过图表显示的宏
全部回答
- 1楼网友:一个很哇塞的汉子
- 2021-12-21 13:33
seriescollection(1).xvalues = sheet1!r1c6:r1c12 横坐标
seriescollection(1).values = 。。。。。纵坐标
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯