cjwescott1
New Member
- Joined
- May 20, 2021
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
I would like to initialize multiple textbox values in a userform transferring data from a worksheet into the userform. I found the code below on a web search however the code doesn't work as I believe the code needs to be contained within a private sub. I would like the code to be in a public sub.
Code which doesn't work below:
dim i as integer
for i = 1 to 10
controls("TextBoxA" & i) = cells(i, 1)
controls("TextBoxB" & i) = cells(i, 2)
...
next i
I receive an error, "sub or function not defined".
Anyone's assistance on this would be much appreciated.
Code which doesn't work below:
dim i as integer
for i = 1 to 10
controls("TextBoxA" & i) = cells(i, 1)
controls("TextBoxB" & i) = cells(i, 2)
...
next i
I receive an error, "sub or function not defined".
Anyone's assistance on this would be much appreciated.