can't transfer to worksheet

S

stewart

I have the following code that inputs a specified number of textboxes
based on the users input in another textbox. I am having trouble
passing info from the created textboxes to a worksheet. When I try to
run the code it comes up with object required. I tried the code with
a textbox that is put there at design time and it works fine. Please
help me.

'code to create boxes
sub
For i = 1 To txtQty.Value Step 1

With Me.Controls.Add("Forms.textbox.1")
.Top = 115 + (17 * i)
.Left = 20
.Height = 17
.Width = 50
.Name = "txtNum" & i
End With
Next i
end sub

'code to transfer data
Private Sub CommandButton1_Click()

ActiveSheet.Range("a1") = txtNum1.Value
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top