|
直接的に書けばこんな?
チェックボックスとセルの列番号の関連の決まりが有ればもっと簡単に成るかも?
テストしていないので間違ったらゴメン
Private Sub CommandButton1_Click()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim strTmp As String
i = 3
With Sheets("記録用シート")
Do
i = i + 1
If .Cells(i, 1) = "" Then
Exit Do
End If
Loop
.Cells(i, 1).Value = TextBox1.Value
For j = 1 To 60
If Me.Controls("CheckBox1" & j).Value Then
strTmp = "レ"
Else
strTmp = ""
End If
Select Case j
Case 1 To 2
k = j + 8
Case 59 To 60
k = j + 18
Case Else '?
k = j + 28
End Select
.Cells(i, k).Value = strTmp
Next i
End With
End Sub
|
|