How do we assign textbox to cell to continue adding data using userform?

charles2010

New Member
Joined
Mar 11, 2010
Messages
3
Hi guys,

I'm still at the learning stage on how to build userforms for data entry in my worksheet.

I already have a worksheet done up and am now trying to create a userform to speed up the data entry process. But I'm stuck because the tutorials out there only teach us how to assign the first textbox to the first column of the sheet.

How do we code the first textbox to a different cell in the worksheet and start adding data from there?

Been trying to match the textbox to a different cell but when I add new data, the new data overwrites the old data in the cell....

Please help? I'm loosing sleep on this puzzle....

To better illustrate this, here's the file...
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi Charles, welcome to the board,

This bit of code takes 4 textboxes and puts the data in Col's A:D, and keeps adding data below. Put this code on a button on your userform;
Code:
Private Sub cmdAdd_Click()

Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

'find first row in database
irow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row

With ws
.Range("A" & irow) = TextBox1.Value
.Range("B" & irow) = TextBox2.Value
.Range("C" & irow) = TextBox3.Value
.Range("D" & irow) = TextBox4.Value

End With
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""

End Sub

it also clears the textboxes ready for the next entry;

HTH
Colin
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,901
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top