Populate next row with UserForm data

loststudent

New Member
Joined
Jan 25, 2018
Messages
7
Hi, everyone!

I'm currently doing a VBA application for updating a company's stock.

I'm trying to get the data from the UserForm combo boxes and text boxes to go into a spreadsheet but all I have so far is data going to the chosen cells. Everytime I clear the UserForm and add other data, those cells keep updating themselves, instead of moving on to the next row and populating it.

This is the code I have:

Code:
Private Sub CmmBAddOrder_Click()

Sheet3.Range("C5").Activate


ActiveCell.Value = TxtBoxOrderNo
ActiveCell.Offset(0, 1).Value = TxtBoxSupplier
ActiveCell.Offset(0, 2).Value = TxtBoxDate
ActiveCell.Offset(1, 0).Select

End Sub


I have tried many variations of this code, hoping it would work, but it either gets me 2 cells with the same value or keep updating the same cells.

Could someone (please please please) help me with a code that would make the data populate the next rows everytime I complete the UserForm?

Thank you :)
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Maybe
Code:
Private Sub CmmBAddOrder_Click()

With Sheet3.Range("C" & Rows.Count).End(xlUp).Offset(1)
   .Value = TxtBoxOrderNo
   .Offset(0, 1).Value = TxtBoxSupplier
   .Offset(0, 2).Value = TxtBoxDate
End With
End Sub
 
Last edited:
Upvote 0
another way perhaps:

Code:
Private Sub CmmBAddOrder_Click()
    Sheet3.Range("C" & Sheet3.Rows.Count).End(xlUp).Offset(1).Resize(, 3).Value = _
    Array(Me.TxtBoxOrderNo, Me.TxtBoxSupplier, Me.TxtBoxDate)
End Sub

Dave
 
Last edited:
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0
Hi, everyone!

I'm currently doing a VBA application for updating a company's stock.

I'm trying to get the data from the UserForm combo boxes and text boxes to go into a spreadsheet but all I have so far is data going to the chosen cells. Everytime I clear the UserForm and add other data, those cells keep updating themselves, instead of moving on to the next row and populating it.

This is the code I have:

Code:
Private Sub CmmBAddOrder_Click()

Sheet3.Range("C5").Activate


ActiveCell.Value = TxtBoxOrderNo
ActiveCell.Offset(0, 1).Value = TxtBoxSupplier
ActiveCell.Offset(0, 2).Value = TxtBoxDate
ActiveCell.Offset(1, 0).Select

End Sub


I have tried many variations of this code, hoping it would work, but it either gets me 2 cells with the same value or keep updating the same cells.

Could someone (please please please) help me with a code that would make the data populate the next rows everytime I complete the UserForm?

Thank you :)


I had almost identical problem. This thread saved my ***. Thanks everyone
 
Upvote 0

Forum statistics

Threads
1,224,749
Messages
6,180,730
Members
452,995
Latest member
isldboy

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