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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
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,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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