Next Empty Row

seasmith

New Member
Joined
Jul 6, 2011
Messages
44
I have used code like this

Range("A65536").End(xlUp)(2, 1) = txtrelief.Text

before to find the next empty row and have a text box from a form print to that row. This time though I am having some problems. Whatever I type in the text box on the form lets say I type in JimJones it enters the informating
J
Ji
Jim
JimJ
JimJo and so on
can anyone help me with this? Or is there any other code I could use to find the next empty row and have a text box from a form print in it?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
You are probably using the wrong event on the form. It should be something like

Code:
Private Sub TextBox1_Enter()
Range("A" & Rows.Count).End(xlUp).Offset(1).Value = TextBox1.Text
End Sub
 
Upvote 0
Have you put this code in the Change event of the textbox?

If you have it will get triggered every time you type a character (or delete from) in the textbox.

So when you type 'J' it runs the code and puts 'J' in the next empty row.

Then when you type 'i' it runs the code and puts 'Ji' in the next empty row, which is the row below where 'J' was put.

And so on.
 
Upvote 0
To Norie yes it is in the change event but my previous code like this that I have used before is also in the Change event and works just fine. So I'm not sure what is different.

To VoG I've tried using your code, and trying different things with the code that I have but with your code I can't get anything to print to the spreadsheet
 
Upvote 0
Personaly I would put a button on the form then use

Code:
Private Sub CommandButton1_Click()
Range("A" & Rows.Count).End(xlUp).Offset(1).Value = TextBox1.Text
End Sub
 
Upvote 0
Well I have a Next button on the form so you would suggest putting that code for the button so when you click the button it enters it?
 
Upvote 0
Just out of curiosity was the previous code exactly the same?
 
Upvote 0

Forum statistics

Threads
1,224,605
Messages
6,179,860
Members
452,948
Latest member
UsmanAli786

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