|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 ning84 于 2023-2-16 11:11 编辑
在Excel2003中, .HasAxis(xlCategory, xlSecondary) = False 结果是目标需求。
改为Excel2007, .HasAxis(xlCategory, xlSecondary) = False,这条语句出错.HasAxis(xlValue, xlSecondary) = True-----结果为False
- Sub del()
- Dim XlsChart As Chart
- Set XlsChart = Sheet1.Application.Charts(1)
- With XlsChart
- .HasAxis(xlCategory, xlPrimary) = True
- .HasAxis(xlCategory, xlSecondary) = False
- .HasAxis(xlValue, xlPrimary) = True
- .HasAxis(xlValue, xlSecondary) = True
- Debug.Print .HasAxis(xlValue, xlSecondary)
- Stop
- With .Axes(xlValue)
- .MinimumScale = 0.3
- .MaximumScale = 0.8
- .MinorUnit = 0.2
- .MajorUnit = 0.4
- .Crosses = xlCustom
- .CrossesAt = 0.2
- .ReversePlotOrder = False
- .ScaleType = xlLinear
- .DisplayUnit = xlNone
- End With
- End With
- End Sub
复制代码
.HasAxis(xlCategory, xlSecondary) = True
- Sub del()
- Dim XlsChart As Chart
- Set XlsChart = Sheet1.Application.Charts(1)
- With XlsChart
- .HasAxis(xlCategory, xlPrimary) = True
- .HasAxis(xlCategory, xlSecondary) = True
- .HasAxis(xlValue, xlPrimary) = True
- .HasAxis(xlValue, xlSecondary) = True
- Debug.Print .HasAxis(xlValue, xlSecondary)
-
- With .Axes(xlValue)
- .MinimumScale = 0.05
- .MaximumScale = 0.9
- .MinorUnit = 0.4
- .MajorUnit = 0.4
- .Crosses = xlCustom
- .CrossesAt = 0.2
- .ReversePlotOrder = False
- .ScaleType = xlLinear
- .DisplayUnit = xlNone
- End With
- For ii = 3 To 4
- With .SeriesCollection(ii)
- .Border.ColorIndex = ii
- .Border.Weight = xlThick
- Select Case ii
- Case 3
- .MarkerStyle = xlCircle
- .MarkerBackgroundColorIndex = 30
- .MarkerForegroundColorIndex = 5
- Case 4
- .MarkerStyle = xlMarkerStyleStar 'xlSquare
- .MarkerBackgroundColorIndex = 45
- .MarkerForegroundColorIndex = 10
- End Select
- ''
- .Smooth = False
- .MarkerSize = 12
- .Shadow = True
- End With
- Next ii
- End With
- End Sub
复制代码
|
|