|
-
Apr 27th, 2006, 02:34 AM
#1
Thread Starter
New Member
vb and excel
Hey.
I have text boxes in an excel worksheet, and I want to input data into these text boxes and then click a command button which puts these text values into a new row in another worksheet. Just wondering if there are any basic ideas how I can go about doing this.
Thanks
-
Apr 27th, 2006, 02:43 AM
#2
Re: vb and excel
Welcome to the Forums.
Moved 
What type of textboxes are they? ActiveX or Forms textboxes?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 27th, 2006, 03:28 AM
#3
Thread Starter
New Member
-
Apr 27th, 2006, 09:01 AM
#4
Lively Member
Re: vb and excel
Try this, but with specifics changed to suit your spreadsheet/requirements. The textbox and command button can be on any sheet within the workbook.
VB Code:
Private Sub CommandButton1_Click()
'Declare your data type - note that if you set a specific data
'type such as numeric, you must trap for non-numeric entries
Dim X As String
'Set variable equal to textbox value
X = TextBox1.Value
'Add data to cell A1 of Sheet2 - you can change this to any cell
'on any sheet witin the workbook
With ActiveWorkbook
Worksheets("Sheet2").Range("A1").FormulaR1C1 = X
End With
'Note that each time you click the command button, the data in cell
'A1 will be overwritten with the data in your text box
End Sub
Hope this helps.
EDIT:
Just realised that you said your textboxes were forms type. This code relates to control toolbox textboxes. Are you sure you have form type textboxes in Excel? When I use forms in Excel (2003), the textbox FormField is not available.
Last edited by New2vba; Apr 27th, 2006 at 12:02 PM.
"Those things we must learn to do, we must learn by doing" (or hope somebody else will take pity and help out )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|