View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
stewart stewart is offline
external usenet poster
 
Posts: 44
Default can't transfer to worksheet

On Sep 12, 9:33 pm, Dave Peterson wrote:
ActiveSheet.Range("a1") = Me.Controls("txtNum1").Value



stewart wrote:

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


--

Dave Peterson


Bingo...Thanks again