質問編集履歴
3
文言修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -144,6 +144,8 @@
|
|
144
144
|
|
145
145
|
|
146
146
|
|
147
|
+
|
148
|
+
|
147
149
|
【追加】ココから================================
|
148
150
|
|
149
151
|
```
|
@@ -199,3 +201,81 @@
|
|
199
201
|
End Sub
|
200
202
|
|
201
203
|
```
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
```
|
208
|
+
|
209
|
+
Public Function AddRow(Sh As Object) As Long
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
Dim LastRo As Long
|
214
|
+
|
215
|
+
Dim TargetRo As Long
|
216
|
+
|
217
|
+
Dim Tpos As Double
|
218
|
+
|
219
|
+
Dim RefNum As Long
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
With Sh
|
224
|
+
|
225
|
+
LastRo = Module1.GetLastRow(Sh, .Rows.Count, 2)
|
226
|
+
|
227
|
+
TargetRo = LastRo + 1
|
228
|
+
|
229
|
+
AddRow = TargetRo
|
230
|
+
|
231
|
+
.Rows(TargetRo).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
|
232
|
+
|
233
|
+
.Rows(TargetRo).RowHeight = 20
|
234
|
+
|
235
|
+
'整理番号
|
236
|
+
|
237
|
+
RefNum = TargetRo - 5
|
238
|
+
|
239
|
+
'グローバル変数;記入対象の行
|
240
|
+
|
241
|
+
CiteRo = TargetRo
|
242
|
+
|
243
|
+
.Cells(TargetRo, 2).Value = RefNum
|
244
|
+
|
245
|
+
'「工事名」の記入
|
246
|
+
|
247
|
+
.Cells(TargetRo, 5).Value = "未記入"
|
248
|
+
|
249
|
+
End With
|
250
|
+
|
251
|
+
Tpos = (RefNum - 1) * 19.8 + 90.6
|
252
|
+
|
253
|
+
'Tpos = (RefNum - 1) * 19.584 + 96.768
|
254
|
+
|
255
|
+
'罫線引き
|
256
|
+
|
257
|
+
Call DrawRuledLines(Sh, TargetRo, 2, 13)
|
258
|
+
|
259
|
+
'[記入]と[削除]ボタン作成
|
260
|
+
|
261
|
+
Call MakeCmdButton(Sh, 73.8, Tpos, 35.4, 19.8, RefNum)
|
262
|
+
|
263
|
+
'Call MakeCmdButton(Sh, 70.848, Tpos, 35.136, 20.1, RefNum)
|
264
|
+
|
265
|
+
'[記入]ボタンのプロシージャ作成
|
266
|
+
|
267
|
+
Call ShowProcInsert(Sh.CodeName, RefNum, TargetRo)
|
268
|
+
|
269
|
+
'[削除]ボタンのプロシージャ作成
|
270
|
+
|
271
|
+
Call DelButtonProcInsert(Sh.CodeName, RefNum)
|
272
|
+
|
273
|
+
'[適用現場を追加]ボタンの Enable=False/True
|
274
|
+
|
275
|
+
Call CiteAddButtonEnabledChange(Sh)
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
End Function
|
280
|
+
|
281
|
+
```
|
2
文言修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -144,6 +144,8 @@
|
|
144
144
|
|
145
145
|
|
146
146
|
|
147
|
+
【追加】ココから================================
|
148
|
+
|
147
149
|
```
|
148
150
|
|
149
151
|
Private Sub DelButtonProcInsert(ShCodeName As String, Num As Long)
|
1
DelButtonProcInsert 追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -141,3 +141,59 @@
|
|
141
141
|
|
142
142
|
|
143
143
|
自分が混乱しているのは自覚しているのですが何か案があればと書き込み失礼いいたします。
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
```
|
148
|
+
|
149
|
+
Private Sub DelButtonProcInsert(ShCodeName As String, Num As Long)
|
150
|
+
|
151
|
+
'[削除]ボタンのプロシージャ作成
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
Dim DelProcName As String
|
156
|
+
|
157
|
+
Dim Cnt As Long
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
DelProcName = "Del" & Num & "_Click"
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
With ThisWorkbook.VBProject.VBComponents(ShCodeName).CodeModule
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
On Error Resume Next
|
170
|
+
|
171
|
+
'同名のプロシージャがなければエラー発生、あればCnt>0
|
172
|
+
|
173
|
+
Cnt = .ProcBodyLine(DelProcName, 0)
|
174
|
+
|
175
|
+
On Error GoTo 0
|
176
|
+
|
177
|
+
If Cnt > 0 Then Exit Sub '←同名のプロシージャがなければ Cnt=0
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
.insertlines 1, "Private Sub " & DelProcName & "()"
|
182
|
+
|
183
|
+
.insertlines 2, "'Del" & Num & "Button"
|
184
|
+
|
185
|
+
.insertlines 3, vbTab & "Call ThisWorkbook.DelButtonClick(Activesheet," & Num & ")"
|
186
|
+
|
187
|
+
' .insertlines 3, vbTab & "If Not Application.EnableEvents Then Exit Sub"
|
188
|
+
|
189
|
+
' .insertlines 4, vbTab & "Call Module3.DelRow(Activesheet," & Num & ")"
|
190
|
+
|
191
|
+
.insertlines 4, "End Sub"
|
192
|
+
|
193
|
+
End With
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
End Sub
|
198
|
+
|
199
|
+
```
|