| 
    
     |  | ▼Hirofumi さん: 
 
 Private Sub CommandButton1_Click()
 
 Dim i As Long
 Dim lngRow As Long
 Dim lngColumn As Long
 Dim 行 As Long
 行 = ActiveCell.Row
 
 For i = 1 To 18
 If Me.Controls("CheckBox" & i) Then
 lngColumn = (j Mod 4) * 8
 lngRow = (j \ 4) * 2
 ActiveSheet.Cells(行, 6 + i - 1).Copy _
 Sheet2.Cells(6 + lngRow, _
 3 + lngColumn).Resize(2, 7)
 j = j + 1
 End If
 Next i  '上記の記述でうまくいきました<(_ _)>
 '下記の記述をいれますと i As Integerでデバッグになってしまいます
 
 
 Dim myMSG As String
 Dim myFlg As Boolean, i As Integer
 myFlg = False
 For x = 1 To 18
 If Me.Controls("CheckBox" & x).Value = True Then
 myMSG = myMSG & Me.Controls("CheckBox" & x).Caption & vbCrLf
 myFlg = True
 End If
 Next x
 If myFlg = True Then
 
 myMSG = myMSG & "宛てで宜しいですか?"
 
 
 Else
 myMSG = "いずれにもチェックが入っていません"
 End If
 MsgBox myMSG
 
 
 End Sub
 
 
 宜しくお願いいたします
 
 |  |