Add new row and add data of one cell to a specific cell through Button

sidvix

New Member
Joined
Jan 6, 2020
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am trying to add a new row with specific formulas/dropdown lists. I need to be able to add new row and copy customer name from one cell to specific cell in last row.


Private Sub CommandButton1_Click()
Dim the_sheet As Worksheet
Dim table_list_object As ListObject
Dim table_object_row As ListRow

Set the_sheet = Sheets("PotentialOrders")
Set table_list_object = the_sheet.ListObjects(1)
Set table_object_row = table_list_object.ListRows.add

table_object_row.Range(1, 1).Value = "0"
table_object_row.Range(1, 3).Value = 'Pick up data from cell "C1" everytime and paste it in Column C (last row)'
table_object_row.Range(1, 6).Value = "Enter Potential Shipping Date"
table_object_row.Range(1, 8).Value = "Select Item No."
table_object_row.Range(1, 9).Value = "Select Packing Type"
table_object_row.Range(1, 10).Value = "Enter Quantity"
table_object_row.Range(1, 11).Value = "Enter Unit Price"

With the_sheet.Cells(the_sheet.Rows.Count, "A").End(xlUp)
.Select ' not required to change the focus/view
ActiveWindow.ScrollRow = .Row
End With

End Sub
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
16,060
Office Version
  1. 2013
Platform
  1. Windows
Change this:
table_object_row.Range(1, 3).Value = 'Pick up data from cell "C1" everytime and paste it in Column C (last row)'

For this:
VBA Code:
table_object_row.Range(1, 3).Value = the_sheet.Range("C1").Value
 
Upvote 0

Forum statistics

Threads
1,191,123
Messages
5,984,780
Members
439,910
Latest member
Flyingjoblo

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