pimp_mentality
New Member
- Joined
- Oct 15, 2015
- Messages
- 46
Good Day All
Hopefully this isn't a silly question as sometimes silly questions are ignored
I use the following code to save data to my work sheet using only textboxes
The issue is due to the nature of the userform and the data being inputed, a Userform which incoperates TextBoxes, ComboBoxes, Checkboxes and Optionbuttons would be much more ideal and effecient for my needs. As it is now the above code can only save only One control (hope i'm using the terminology right) i.e. TextBoxes.
I would appreciate assistance in modifying the above code (as needed) so that I can utilise TextBoxes, ComboBoxes as well as other controls and still accomodate the 300 plus comtrols (or more) as may be required.
The ususal consideration from forum members is most appreciated
Hopefully this isn't a silly question as sometimes silly questions are ignored
I use the following code to save data to my work sheet using only textboxes
Code:
Dim t As Control, res As VbMsgBoxResult, i As Long, TextBox As Control, z As ControlDim a As Long, b As Long
Dim x As Integer
a = Sheets("Student Info").Columns(1).Find(Reg1.Value, , , 1).Row
b = Sheets("Student Info").Cells(a, Columns.Count).End(xlToLeft).Column
For Each t In Me.Controls
If TypeName(t) = "TextBox" Then
If t.Text = vbNullString Then t.Text = ""
End If
Next
For i = 4 To 320
Sheets("Student Info").Cells(a, b + (i - 3)).Value = Me.Controls("TextBox" & i).Value
Next i
Unload Me
The issue is due to the nature of the userform and the data being inputed, a Userform which incoperates TextBoxes, ComboBoxes, Checkboxes and Optionbuttons would be much more ideal and effecient for my needs. As it is now the above code can only save only One control (hope i'm using the terminology right) i.e. TextBoxes.
I would appreciate assistance in modifying the above code (as needed) so that I can utilise TextBoxes, ComboBoxes as well as other controls and still accomodate the 300 plus comtrols (or more) as may be required.
The ususal consideration from forum members is most appreciated
Last edited: