![]() |
can't transfer to worksheet
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 |
can't transfer to worksheet
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 |
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 |
All times are GMT +1. The time now is 06:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com