|
-
Dec 21st, 2005, 08:17 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Excel form
I have a small form in excel (textbox1, textbox2, cmdbutton1)
When a use hits submit I want the data in textbox1 and textbox2 to display on my Worksheet(1) spreadsheet; textbox1 value into Column A and textbox2 in Column B.
I already have 80 rows in this sheet so how do I make it add a new row everytime.
-
Dec 21st, 2005, 08:41 AM
#2
Lively Member
Re: Excel form
This is the solution for you using vb code. Open the forms code box in vb mode (I guess you used excel vb to create the form), then apply this code
Code:
Private Sub cmdbutton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("sheet1")
'moves to the next empty row
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'enters data onto sheet1
ws.Cells(iRow, 1).Value = Me.textbox1.Value
ws.Cells(iRow, 2).Value = Me.textbox2.Value
'resets form
Me.textbox1.Value = ""
Me.textbox2.Value = ""
End Sub
-
Dec 21st, 2005, 09:28 AM
#3
Thread Starter
Hyperactive Member
Re: Excel form
Thanks sir! I will try right now.
-
Dec 21st, 2005, 09:56 AM
#4
Thread Starter
Hyperactive Member
-
Dec 21st, 2005, 09:57 AM
#5
Thread Starter
Hyperactive Member
Re: Excel form
Is there anyway I can find the syntax how to do this stuff without asking??
-
Dec 21st, 2005, 11:35 AM
#6
Lively Member
Re: [RESOLVED] Excel form
sorry, I don't no of any website that provides complete reference for coding but if you find one be sure to let me know
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
|