I have a UserForm with 12 TextBoxes the values of which I need to enter into a WorkSheet.
I have given these controls tab indexes from 0 to 11.
I have been trying, unsuccessfully, to write code that will do the transfer on the lines of:-
Sub Transfer()
Dim RowNo As Integer
RowNo defined in code
With UserForm1
For tabIndex = 0 to 11
Sheets("Data").Range(Cells(RowNo,TabIndex).Value = .Controls.TabIndex.Value
Next
End With
End Sub
I know that I could accomplish this by using a control name such as "TextBox" & i but this way is not available to me as it is being used already for another purpose.
I hope that somebody will be able to put me on the right path.
John
Bookmarks