|
3.の場合だとすると、下記のコードでどうしょう。
Private Sub CommandButton1_Click()
Dim i As Long, j As Long
Dim rngOutput As Range, wsInput As Worksheet
Dim a As Long
Set wsInput = Worksheets("アンケート項目")
Set rngOutput = Worksheets("シートA").Range("投入範囲")
a = rngOutput.Rows.Count
rngOutput.Rows(a).Insert Shift:=xlDown
rngOutput.Cells(a, 1).Value = Me.TextBox1
For i = 1 To 17
With Me.Controls("Frame" & i)
For j = 0 To .Controls.Count - 1
If .Controls(j).Value Then
rngOutput.Cells(a, i + 1).Value = wsInout.Cells(j + 3, i + 2)
End If
Next
End With
Next
End Sub
|
|