|
若しくは、
Private Sub CommandButton1_Click()
Dim i As Long
Dim j As Long
Dim lngRow As Long
Dim lngColumn As Long
Dim 行 As Long
Dim myMSG As String
Dim myFlg As Boolean
行 = ActiveCell.Row
myFlg = False
For i = 1 To 19
If Me.Controls("CheckBox" & i) Then
lngColumn = (j Mod 4) * 8
lngRow = (j \ 4) * 2
ActiveSheet.Cells(行, 6 + i - 1).Copy _
Worksheets("Sheet2").Cells(6 + lngRow, _
3 + lngColumn).Resize(2, 7)
myMSG = myMSG & Me.Controls("CheckBox" & i).Caption & vbCrLf
myFlg = True
j = j + 1
End If
Next i
If myFlg = True Then
myMSG = myMSG & "宛てで宜しいですか?"
If MsgBox(myMSG, vbInformation + vbYesNo) = vbYes Then
Sheet2.PrintOut
End If
Else
myMSG = "いずれにもチェックが入っていません"
MsgBox myMSG
End If
' MsgBox myMSG
' Sheet2.PrintOut
End Sub
|
|