由于单元格的值,我想知道如何将图片从spreedsheet附加到Excel图表中的某个点。我一直在使用这段代码:
Sub Makro()
Dim cell As Range
For Each cell In Range("D39:O39")
If cell.Value < Range("D41") And cell.Value <> 0 Then
ActiveSheet.Shapes.Range(Array("Obraz 18")).Select
Selection.Copy
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.Paste
Selection.ShapeRange.IncrementLeft 342
Selection.ShapeRange.IncrementTop 19.5
ElseIf cell.Value >= Range("D41") And cell.Value < Range("D40") Then
ActiveSheet.Shapes.Range(Array("Obraz 22")).Select
Selection.Copy
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.Paste
Selection.ShapeRange.IncrementLeft 342
Selection.ShapeRange.IncrementTop 19.5
ElseIf cell.Value > Range("D40") Then
ActiveSheet.Shapes.Range(Array("Obraz 19")).Select
Selection.Copy
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.Paste
Selection.ShapeRange.IncrementLeft 342
Selection.ShapeRange.IncrementTop 19.5
End If
Next cell
End Sub
但是我必须手动将图片拖到它所代表的图表上的线上。有没有办法将点转换为图表方向,我可以将其用作变量?或者另一种方式?感谢