Originally Posted by
rakotonirinas
... if 4 textboxes are checked then there will be 4 rows of data ... etc.
This code is not for this form (?):
1. You have 6 (not 4 textboxes, but) CheckBoxes to check
2. Where it is TextBox number: 13, 14, 15, 16, etc. ?
For j = 13 To 24
'...
Addto.Offset(, 6) = Me.TextBox("TextBox" & j).Value ' ?!
Addto.Offset(, 7) = ctl.Name
'...
Next
3. and not as above "Me.TextBox("TextBox" & j)", but :
... Me.Controls("TextBox" & j)...
4. "For ... Next" loops are wrong constructed, maybe it's about something like that ?:
With Sheets("Database")
For i = 1 To 6
If Me.Controls("CheckBox" & i).Value Then
With .Range("A" & .Rows.Count).End(xlUp).Offset(1)
.Resize(, 6) = Array(cmbDate.Value, TextBox1.Value, TextBox2.Value, TextBox3.Value, TextBox4.Value, TextBox5.Value)
For j = 13 To 24 '=> ???!!!
.Offset(, 6) = Me.Controls("TextBox" & j).Value '???!!!
Next
.Offset(, 7) = ctl.Name '???!!!
End With
End If
Next
End With
5. Where are ?:
Dim ctl As Control
Dim chkBox As CheckBox
Dim lRow As Single
Bookmarks