Nitehawkhp
New Member
- Joined
- Dec 2, 2016
- Messages
- 37
I have a column of data in a worksheet and need to load that data into text boxes on a userform.
I have done this in the past, however, I can’t get the code to work in this new situation.
A sample of the worksheet data consists of the following:
[TABLE="class: grid, width: 200"]
<tbody>[TR]
[TD]Row[/TD]
[TD]Description[/TD]
[TD]Yes/No[/TD]
[TD]Distance[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Vendor[/TD]
[TD] User Response[/TD]
[TD] User Response[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Category[/TD]
[TD] User Response[/TD]
[TD] User Response[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Series[/TD]
[TD] User Response[/TD]
[TD] User Response[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Orientation[/TD]
[TD] User Response[/TD]
[TD] User Response[/TD]
[/TR]
</tbody>[/TABLE]
I need a macro that will transfer the data into Userform
The Description column will be loaded into TextBoxes on a Userform called:
Textbox1
Textbox2
Textbox3
Textbox4
I have used the following code in a different worksheet and it works.
However, when I use it now I get a compile error
Sub or Function not defined
I have changed the sheets name to match the new worksheet and,
range name for the data.
I have looked up controls and tried to figure out what was needed for that command, but
I don't understand.
Thanks for any help you can provide me.
Rod
I have done this in the past, however, I can’t get the code to work in this new situation.
A sample of the worksheet data consists of the following:
[TABLE="class: grid, width: 200"]
<tbody>[TR]
[TD]Row[/TD]
[TD]Description[/TD]
[TD]Yes/No[/TD]
[TD]Distance[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Vendor[/TD]
[TD] User Response[/TD]
[TD] User Response[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Category[/TD]
[TD] User Response[/TD]
[TD] User Response[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Series[/TD]
[TD] User Response[/TD]
[TD] User Response[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Orientation[/TD]
[TD] User Response[/TD]
[TD] User Response[/TD]
[/TR]
</tbody>[/TABLE]
I need a macro that will transfer the data into Userform
The Description column will be loaded into TextBoxes on a Userform called:
Textbox1
Textbox2
Textbox3
Textbox4
I have used the following code in a different worksheet and it works.
Code:
Dim i As Integer
Sheets("Players").Select
Range("C2").Select
ToCount = Range("G2")
For i = 1 To ToCount
Controls("Player" & i) = Cells(i + 1, 3)
Next i
However, when I use it now I get a compile error
Sub or Function not defined
Code:
Dim i As Integer
Sheets("Data Validation").Select
ToCount = Range("X1").Value
For i = 1 To ToCount
Controls("Data" & i) = Cells(i + 1, 3)
Next i
I have changed the sheets name to match the new worksheet and,
range name for the data.
I have looked up controls and tried to figure out what was needed for that command, but
I don't understand.
Thanks for any help you can provide me.
Rod
Last edited: