質問編集履歴
2
インシデント追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,8 +8,40 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
+
#インシデント
|
12
|
+
|
13
|
+
例えば下記の部分であれば、cells(9,7)のセルの数値+dをcells(9,8)に出力するというものですが
|
14
|
+
|
15
|
+
ボタンを押したときの場合、dのみの値になってしまっています。
|
16
|
+
|
17
|
+
コード入力の実行の部分であれば問題なく作動します。
|
18
|
+
|
11
19
|
```vba
|
12
20
|
|
21
|
+
Dim d As Integer
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
d = Cells(Cells(9, 15).Value + 1, 2).Value
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
Cells(9, 8).Value = Cells(9, 7).Value + d
|
30
|
+
|
31
|
+
Cells(10, 8).Value = Cells(10, 7).Value + d
|
32
|
+
|
33
|
+
Cells(11, 8).Value = Cells(11, 7).Value + d
|
34
|
+
|
35
|
+
Cells(12, 8).Value = Cells(12, 7).Value + d
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
```vba
|
44
|
+
|
13
45
|
Sub ボタン1_Click()
|
14
46
|
|
15
47
|
|
1
変数bはdでした。失礼いたしました。sheet1がアクティブかと思います。
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,12 +2,14 @@
|
|
2
2
|
|
3
3
|
結果的には、後者の入力のときは正しく入力されます。
|
4
4
|
|
5
|
-
変数
|
5
|
+
変数dは、どちらも正しく読み込まれておりますが、前者でのみcell(x,7).valueの値が読み込まれず、dのままの数値になります。
|
6
6
|
|
7
7
|
わかりずらい説明で申し訳ありませんがどなたか解決方法を教えていただきたいです。
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
+
```vba
|
12
|
+
|
11
13
|
Sub ボタン1_Click()
|
12
14
|
|
13
15
|
|
@@ -16,49 +18,49 @@
|
|
16
18
|
|
17
19
|
|
18
20
|
|
19
|
-
|
21
|
+
Dim d As Integer
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
|
23
|
+
|
24
|
+
|
23
|
-
|
25
|
+
d = Cells(Cells(9, 15).Value + 1, 2).Value
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
|
27
|
+
|
28
|
+
|
27
|
-
|
29
|
+
Cells(9, 8).Value = Cells(9, 7).Value + d
|
28
|
-
|
30
|
+
|
29
|
-
|
31
|
+
Cells(10, 8).Value = Cells(10, 7).Value + d
|
30
|
-
|
32
|
+
|
31
|
-
|
33
|
+
Cells(11, 8).Value = Cells(11, 7).Value + d
|
32
|
-
|
34
|
+
|
33
|
-
|
35
|
+
Cells(12, 8).Value = Cells(12, 7).Value + d
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
|
37
|
+
|
38
|
+
|
37
|
-
|
39
|
+
Call fanc1
|
38
|
-
|
39
|
-
|
40
|
+
|
41
|
+
|
40
42
|
|
41
43
|
ElseIf Cells(9, 13) = "2" Then
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
+
|
46
|
+
|
45
|
-
|
47
|
+
p = Cells(Cells(9, 13).Value + 1, 2).Value
|
46
|
-
|
48
|
+
|
47
|
-
|
49
|
+
d = Cells(Cells(9, 15).Value + 1, 2).Value
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
|
51
|
+
|
52
|
+
|
51
|
-
|
53
|
+
Cells(9, 8).Value = Cells(9, 7).Value + d
|
52
|
-
|
54
|
+
|
53
|
-
|
55
|
+
Cells(13, 8).Value = Cells(13, 7).Value + d
|
54
|
-
|
56
|
+
|
55
|
-
|
57
|
+
Cells(14, 8).Value = Cells(14, 7).Value + d
|
56
|
-
|
58
|
+
|
57
|
-
|
59
|
+
Cells(15, 8).Value = Cells(15, 7).Value + d
|
58
|
-
|
59
|
-
|
60
|
-
|
60
|
+
|
61
|
+
|
62
|
+
|
61
|
-
|
63
|
+
Call fanc1
|
62
64
|
|
63
65
|
|
64
66
|
|
@@ -66,47 +68,47 @@
|
|
66
68
|
|
67
69
|
|
68
70
|
|
69
|
-
|
71
|
+
p = Cells(Cells(9, 13).Value + 1, 2).Value
|
70
|
-
|
72
|
+
|
71
|
-
|
73
|
+
d = Cells(Cells(9, 15).Value + 1, 2).Value
|
72
|
-
|
73
|
-
|
74
|
-
|
74
|
+
|
75
|
+
|
76
|
+
|
75
|
-
|
77
|
+
Cells(10, 8).Value = Cells(10, 7).Value + d
|
76
|
-
|
78
|
+
|
77
|
-
|
79
|
+
Cells(13, 8).Value = Cells(13, 7).Value + d
|
78
|
-
|
80
|
+
|
79
|
-
|
81
|
+
Cells(16, 8).Value = Cells(16, 7).Value + d
|
80
|
-
|
82
|
+
|
81
|
-
|
83
|
+
Cells(17, 8).Value = Cells(17, 7).Value + d
|
82
|
-
|
83
|
-
|
84
|
-
|
84
|
+
|
85
|
+
|
86
|
+
|
85
|
-
|
87
|
+
Call fanc1
|
86
|
-
|
87
|
-
|
88
|
+
|
89
|
+
|
88
90
|
|
89
91
|
ElseIf Cells(9, 13) = "4" Then
|
90
92
|
|
91
93
|
|
92
94
|
|
93
|
-
|
95
|
+
p = Cells(Cells(9, 13).Value + 1, 2).Value
|
94
|
-
|
96
|
+
|
95
|
-
|
97
|
+
d = Cells(Cells(9, 15).Value + 1, 2).Value
|
96
|
-
|
97
|
-
|
98
|
-
|
98
|
+
|
99
|
+
|
100
|
+
|
99
|
-
|
101
|
+
Cells(11, 8).Value = Cells(11, 7).Value + d
|
100
|
-
|
102
|
+
|
101
|
-
|
103
|
+
Cells(14, 8).Value = Cells(14, 7).Value + d
|
102
|
-
|
104
|
+
|
103
|
-
|
105
|
+
Cells(16, 8).Value = Cells(16, 7).Value + d
|
104
|
-
|
106
|
+
|
105
|
-
|
107
|
+
Cells(18, 8).Value = Cells(18, 7).Value + d
|
106
|
-
|
107
|
-
|
108
|
-
|
108
|
+
|
109
|
+
|
110
|
+
|
109
|
-
|
111
|
+
Call fanc1
|
110
112
|
|
111
113
|
|
112
114
|
|
@@ -114,23 +116,23 @@
|
|
114
116
|
|
115
117
|
|
116
118
|
|
117
|
-
|
119
|
+
p = Cells(Cells(9, 13).Value + 1, 2).Value
|
118
|
-
|
120
|
+
|
119
|
-
|
121
|
+
d = Cells(Cells(9, 15).Value + 1, 2).Value
|
120
|
-
|
121
|
-
|
122
|
-
|
122
|
+
|
123
|
+
|
124
|
+
|
123
|
-
|
125
|
+
Cells(12, 8).Value = Cells(12, 7).Value + d
|
124
|
-
|
126
|
+
|
125
|
-
|
127
|
+
Cells(15, 8).Value = Cells(15, 7).Value + d
|
126
|
-
|
128
|
+
|
127
|
-
|
129
|
+
Cells(17, 8).Value = Cells(17, 7).Value + d
|
128
|
-
|
130
|
+
|
129
|
-
|
131
|
+
Cells(18, 8).Value = Cells(18, 7).Value + d
|
130
|
-
|
131
|
-
|
132
|
-
|
132
|
+
|
133
|
+
|
134
|
+
|
133
|
-
|
135
|
+
Call fanc1
|
134
136
|
|
135
137
|
|
136
138
|
|
@@ -146,23 +148,23 @@
|
|
146
148
|
|
147
149
|
|
148
150
|
|
149
|
-
|
151
|
+
Dim p As Integer
|
150
|
-
|
152
|
+
|
151
|
-
|
153
|
+
p = Cells(Cells(9, 13).Value + 1, 2).Value
|
152
|
-
|
153
|
-
|
154
|
+
|
155
|
+
|
154
156
|
|
155
157
|
If Cells(9, 15) = "1" Then
|
156
158
|
|
157
159
|
|
158
160
|
|
159
|
-
|
161
|
+
Cells(9, 8).Value = Cells(9, 7).Value + p
|
160
|
-
|
162
|
+
|
161
|
-
|
163
|
+
Cells(10, 8).Value = Cells(10, 7).Value + p
|
162
|
-
|
164
|
+
|
163
|
-
|
165
|
+
Cells(11, 8).Value = Cells(11, 7).Value + p
|
164
|
-
|
166
|
+
|
165
|
-
|
167
|
+
Cells(12, 8).Value = Cells(12, 7).Value + p
|
166
168
|
|
167
169
|
|
168
170
|
|
@@ -170,13 +172,13 @@
|
|
170
172
|
|
171
173
|
|
172
174
|
|
173
|
-
|
175
|
+
Cells(9, 8).Value = Cells(9, 7).Value + p
|
174
|
-
|
176
|
+
|
175
|
-
|
177
|
+
Cells(13, 8).Value = Cells(13, 7).Value + p
|
176
|
-
|
178
|
+
|
177
|
-
|
179
|
+
Cells(14, 8).Value = Cells(14, 7).Value + p
|
178
|
-
|
180
|
+
|
179
|
-
|
181
|
+
Cells(15, 8).Value = Cells(15, 7).Value + p
|
180
182
|
|
181
183
|
|
182
184
|
|
@@ -184,15 +186,13 @@
|
|
184
186
|
|
185
187
|
|
186
188
|
|
187
|
-
|
189
|
+
Cells(10, 8).Value = Cells(10, 7).Value + p
|
188
|
-
|
190
|
+
|
189
|
-
|
191
|
+
Cells(13, 8).Value = Cells(13, 7).Value + p
|
190
|
-
|
192
|
+
|
191
|
-
|
193
|
+
Cells(16, 8).Value = Cells(16, 7).Value + p
|
192
|
-
|
194
|
+
|
193
|
-
|
195
|
+
Cells(17, 8).Value = Cells(17, 7).Value + p
|
194
|
-
|
195
|
-
|
196
196
|
|
197
197
|
|
198
198
|
|
@@ -200,17 +200,13 @@
|
|
200
200
|
|
201
201
|
|
202
202
|
|
203
|
-
|
204
|
-
|
205
|
-
|
203
|
+
Cells(11, 8).Value = Cells(11, 7).Value + p
|
206
|
-
|
204
|
+
|
207
|
-
|
205
|
+
Cells(14, 8).Value = Cells(14, 7).Value + p
|
208
|
-
|
206
|
+
|
209
|
-
|
207
|
+
Cells(16, 8).Value = Cells(16, 7).Value + p
|
210
|
-
|
208
|
+
|
211
|
-
|
209
|
+
Cells(18, 8).Value = Cells(18, 7).Value + p
|
212
|
-
|
213
|
-
|
214
210
|
|
215
211
|
|
216
212
|
|
@@ -218,13 +214,13 @@
|
|
218
214
|
|
219
215
|
|
220
216
|
|
221
|
-
|
217
|
+
Cells(12, 8).Value = Cells(12, 7).Value + p
|
222
|
-
|
218
|
+
|
223
|
-
|
219
|
+
Cells(15, 8).Value = Cells(15, 7).Value + p
|
224
|
-
|
220
|
+
|
225
|
-
|
221
|
+
Cells(17, 8).Value = Cells(17, 7).Value + p
|
226
|
-
|
222
|
+
|
227
|
-
|
223
|
+
Cells(18, 8).Value = Cells(18, 7).Value + p
|
228
224
|
|
229
225
|
|
230
226
|
|
@@ -233,3 +229,5 @@
|
|
233
229
|
|
234
230
|
|
235
231
|
End Function
|
232
|
+
|
233
|
+
```
|