next open row

joacro

Board Regular
Joined
Jun 24, 2010
Messages
158
Hi there,

Someone assist me in this code, where the entries of txtboxes go into the next availible open row:

Private Sub CmdAdd_Click()

LR = Cells(Rows.Count, "A").End(xlUp).Row + 1
Range("A" & LR) = txtPrin
Range("A" & LR + 1) = txtSpouse
Range("A" & LR + 2) = txtCh1
Range("A" & LR + 3) = txtCh2
Range("A" & LR + 4) = txtCh3
Range("A" & LR + 5) = txtCh4
Range("A" & LR + 6) = txtCh5
Range("A" & LR + 7) = txtCh6
End Sub

It is working perfectly, however I need txtTotal to go into the same Row as txtPrin but in Colum "I"

Hope someone can assist me in this

Kind regards

Joacro
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi Vog,

Thank you, the code put the value into I,

However, If I delete the values on the sheet it self, the above code just continue to insert the code where the last one was pasted.

Any solution to this
 
Upvote 0
I need txtTotal to go into the same Row as txtPrin but in Colum "I"

That is exactly what the code that I posted does. Are you saying that you want something different? If so what exactly?
 
Upvote 0
Hi Peter,

Your code is perfect,

If I delete the value on the spreadsheet itself and add new values as per userform, the code continue to past the values in the last row where it pasted the previous values.

I need the code to paste in the first empty row.

Does it make any sense??
 
Upvote 0
Try

Code:
Range("I" & Rows.Count).End(xlUp).Offset(1).Value = txtTotal
 
Upvote 0
Hi Peter,

I think you understand me wrong.

your first code is just perfect.

I have tested the code a few time. Now I have clear all the values on the sheet to start again from say A1, but it keeps on pasting the new values on say A44 where the last value was pasted.

Basically I need to reset the sheet
 
Upvote 0
How are you clearing the values? You need to select them then press Delete
 
Upvote 0

Forum statistics

Threads
1,224,541
Messages
6,179,418
Members
452,912
Latest member
alicemil

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