teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

追記

2021/03/11 12:21

投稿

jinoji
jinoji

スコア4592

answer CHANGED
@@ -20,4 +20,15 @@
20
20
  End With
21
21
  End If
22
22
  Next
23
+ ```
24
+
25
+ なお、Indexの場合なら、以下のように変えたら改善するかもしれません。
26
+
27
+ ```VBA
28
+ With ActiveSheet.ChartObjects(1).Chart.FullSeriesCollection(1).Points(指定マーカー)
29
+ .MarkerStyle = 1
30
+ .MarkerSize = 18
31
+ .MarkerBackgroundColor = RGB(255, 0, 0)
32
+ .MarkerForegroundColor = RGB(255, 0, 0)
33
+ End With
23
34
  ```

1

追記

2021/03/11 12:21

投稿

jinoji
jinoji

スコア4592

answer CHANGED
@@ -1,3 +1,23 @@
1
1
  指定マーカーは 1,2,3, のようなIndexですか?
2
2
  Worksheets("Sheet1")などと異なり、
3
- Pointsの添え字は"S1P1"のような名前ではエラーになるようです。
3
+ Pointsの添え字は"S1P1"のような名前ではエラーになるようです。
4
+
5
+ もし名前で指定したい場合は、たとえば以下のようなコードが考えられます。
6
+ ```VBA
7
+ Dim dic As Scripting.Dictionary
8
+ Set dic = CreateObject("Scripting.Dictionary")
9
+ For i = 1 To 個数
10
+ dic(Sheets(1).Cells(1 + i, 1).Value) = 0
11
+ Next
12
+ Dim pt As Point
13
+ For Each pt In ActiveChart.FullSeriesCollection(1).Points
14
+ If dic.Exists(pt.Name) Then
15
+ With pt
16
+ .MarkerStyle = 1
17
+ .MarkerSize = 8
18
+ .MarkerBackgroundColor = RGB(255, 0, 0)
19
+ .MarkerForegroundColor = RGB(255, 0, 0)
20
+ End With
21
+ End If
22
+ Next
23
+ ```