|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
ChartSheet.SeriesCollection(Object) 方法 (Microsoft.Office.Tools.Excel) | Microsoft Learn https://learn.microsoft.com/zh-c ... tion_System_Object_
DataLabels 方法 (Excel Graph) | Microsoft Learn https://learn.microsoft.com/zh-t ... labels-graph-method
.SeriesCollection(2).DataLabels给颜色赋值要几级?-Excel VBA程序开发-ExcelHome技术论坛 - https://club.excelhome.net/thread-1635098-1-1.html
下面程序卡在这里
人工选择可行,在程序里出问题了。
With Selection
.ReadingOrder = xlLTR
.Position = xlLabelPositionInsideBase 'xlLabelPositionInsideEnd
.Orientation = xlHorizontal
End With
- Sub nnnn()
- Dim objChart As ChartObject
- Dim oChart As Chart
- Dim Shp As Shape
- Dim p As Point
- Set objChart = Sheet1.ChartObjects(1)
- objChart.Select
- Debug.Print objChart.Name
- Set oChart = objChart.Chart
- 'Active.Sheet.ChartObjects(oChart.Name).Activate
- Application.ScreenUpdating = False
- xVals = ActiveChart.SeriesCollection(1).Formula
- 'ActiveChart.Activate
- 'oChart.ChartArea.Select
- 'ActiveChart.SeriesCollection(1).DataLabels.Select
- With oChart
- xx = .SeriesCollection(1).Formula
- Debug.Print xx
- '.DataTable.ShowLegendKey = False
- .SeriesCollection(1).ApplyDataLabels AutoText:=True, LegendKey:= _
- False, ShowSeriesName:=False, ShowCategoryName:=True, ShowValue:=True, _
- ShowPercentage:=False, ShowBubbleSize:=False
- Set p = .SeriesCollection(1).Points(5)
- p.Interior.ColorIndex = 3
-
- Stop
-
- .SeriesCollection(1).DataLabels.Select
-
- '.HorizontalAlignment = xlLeft
- '.VerticalAlignment = xlTop
- With Selection
- .ReadingOrder = xlLTR
- .Position = xlLabelPositionInsideBase 'xlLabelPositionInsideEnd
- .Orientation = xlHorizontal
- End With
- End With
-
- End Sub
复制代码
|
|