new row code

zaahir

Board Regular
Joined
Oct 11, 2006
Messages
55
Hi
Using the ffg code should select a new row. i enter data into a userform & the code pastes it to u workbook called database. instead of selecting the second row, it overwrites the first row.

Sheets("CMFClientInfo").Cells(1, 1).End(xlDown).Offset(1, 0) = Me.txtName.Text
Sheets("CMFClientInfo").Cells(1, 2).End(xlDown).Offset(1, 0) = Me.txtStreet1.Text
Sheets("CMFClientInfo").Cells(1, 3).End(xlDown).Offset(1, 0) = Me.txtStreet2.Text
Sheets("CMFClientInfo").Cells(1, 4).End(xlDown).Offset(1, 0) = Me.txtStreet3.Text
Sheets("CMFClientInfo").Cells(1, 5).End(xlDown).Offset(1, 0) = Me.txtStreetCode.Text
Sheets("CMFClientInfo").Cells(1, 6).End(xlDown).Offset(1, 0) = Me.txtPost1.Text
Sheets("CMFClientInfo").Cells(1, 7).End(xlDown).Offset(1, 0) = Me.txtPost2.Text
Sheets("CMFClientInfo").Cells(1, 8).End(xlDown).Offset(1, 0) = Me.txtPost3.Text
Sheets("CMFClientInfo").Cells(1, 9).End(xlDown).Offset(1, 0) = Me.txtPostCode.Text
Sheets("CMFClientInfo").Cells(1, 10).End(xlDown).Offset(1, 0) = Me.txtContact.Text
Sheets("CMFClientInfo").Cells(1, 11).End(xlDown).Offset(1, 0) = Me.txtVAT.Text
Sheets("CMFClientInfo").Cells(1, 12).End(xlDown).Offset(1, 0) = Me.txtTel.Text
Sheets("CMFClientInfo").Cells(1, 13).End(xlDown).Offset(1, 0) = Me.txtFax.Text

please help remove the problem!!!!!!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

ravishankar

Well-known Member
Joined
Feb 23, 2006
Messages
3,566
your code has fixed the row number as 1 (note: all cells have cells(1,..))

Try adding the following code
ActiveSheet.Cells.SpecialCells(xlLastCell).Select
ir = ActiveCell.Row
change cell address to cells(ir,1), cells(ir, 2) etc.

Ravi
 

Forum statistics

Threads
1,136,420
Messages
5,675,737
Members
419,585
Latest member
popsin

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
Top