EXCEL圖形功能應該做不到,只想到用VBA
1. 需將圖形的水平軸座標軸選項改為"文字座標軸"
2. 貼上VBA程式碼, 執行程式
Private Sub CommandButton1_Click()
Dim I As Integer, RNG As Range
With Sheet1
Set RNG = .Range(.Cells(1, 1), .Cells(1, 4))
For I = 2 To .Cells.SpecialCells(xlCellTypeLastCell).Row
If .Cells(I, 5) <> 0 Then
Set RNG = Union(RNG, .Range(.Cells(I, 1), .Cells(I, 4)))
End If
Next I
.ChartObjects("圖表 1").Chart.SetSourceData Source:=Range(RNG.Address)
End With
End Sub