Populate cells from Macro Textbox

Loin75

Active Member
Joined
Oct 21, 2009
Messages
281
Hi, I have searched everywhere for what I think is very simple, but cannot find what I need.

Stage 1.

I have created a userform that simply has 4 textboxes on it. I would like the contents of the textboxes to populate a table in the worksheet.

Stage 2.

If the macro (userform) is used again, the data would appear on the next line of the table (rather than overwriting the first entry).

I am using Excel 2007. Is this possible?

Many Thanks for any help...
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
This is what your code should now be

Code:
Private Sub CommandButton1_Click()
Add.Hide

Dim iRow As Long

'find first empty row in database
iRow = Range("B1").End(xlDown).Offset(1).Row

'copy the data to the database
Range("B" & iRow).Value = Me.TextBox1.Value
Range("C" & iRow).Value = Me.TextBox2.Value
Range("D" & iRow).Value = Me.TextBox3.Value
Range("E" & iRow).Value = Me.TextBox4.Value

'clear the data
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.TextBox1.SetFocus
End Sub
 
Upvote 0
First check that B3 is actually blank and doesn't contain a space or other invisible character.

You can't upload files to the board but you could upload to a site like www.box.net and provide a link.
 
Upvote 0
Hi,

I am cobbling together something that might do the trick, but need help.

This last code I was given works great to find the next empty cell.

What I need now is a piece of code that will paste the value of textbox 1 into the "currently selected cell".

Is there such a command?
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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