Add new row data

jadhavabhay

New Member
Joined
Dec 28, 2015
Messages
2
I am facing problem with folowing code cant add data to new row


Private Sub Submit_Click()
Dim ssheet As Worksheet
Set ssheet = ThisWorkbook.Sheets("S")
nr = ssheet.Cells(Rows.Count, 1).End(xlUp).Row + 1
ssheet.Cells(nr, 5) = Me.Tb1
ssheet.Cells(nr, 6) = Me.Tb2
ssheet.Cells(nr, 7) = Me.Tb3
ssheet.Cells(nr, 8) = Me.Tb4
ssheet.Cells(nr, 12) = Me.Cb1
ssheet.Cells(nr, 13) = Me.Tb5
ssheet.Cells(nr, 17) = Me.Tb6
ssheet.Cells(nr, 18) = Me.Tb7
ssheet.Cells(nr, 19) = Me.Tb8
ssheet.Cells(nr, 20) = Me.Cb2
ssheet.Cells(nr, 21) = Me.Tb10
ssheet.Cells(nr, 22) = Me.Tb11
ssheet.Cells(nr, 23) = Me.Tb12
ssheet.Cells(nr, 24) = Me.Tb13
ssheet.Cells(nr, 25) = Me.Tb14
ssheet.Cells(nr, 31) = Me.Tb15
ssheet.Cells(nr, 42) = Me.Tb16
ssheet.Cells(nr, 47) = Me.Tb17
End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
What problems are you facing?
 
Upvote 0
If you add a msgbox like this
Code:
nr = ssheet.Cells(Rows.Count, 1).End(xlUp).Row + 1
[COLOR=#0000ff]MsgBox nr[/COLOR]
ssheet.Cells(nr, 5) = Me.TB1
What number is displayed & is it the correct row number?
 
Upvote 0

Forum statistics

Threads
1,216,745
Messages
6,132,473
Members
449,729
Latest member
davelevnt

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