Add a new row in Named Table (Table1) and add data from txtboxes into last empty cells based on header named of the Table1

Joined
Sep 24, 2022
Messages
2
Reaction score
0
Hello All,

I would need your expertise, please.

I have a named Table1 with columns test1, test2, test3, test4 and textbox1,textbox2,textbox3,textbox4
Using click procedure, I would like to create a VBA to add a new row in Table1 and based on with header name of the Table1, the data to be populated from textboxes, so for example, if i want to upload data from textbox1, the code will search in table1 the header test2,then the last empty cell and populate the data in cell
I tried but didnt work.:(...Anyone can guide me on this, please?

Dim col As Long
Dim Row As Long
col = ActiveSheet.ListObjects("Table1").ListColumns("test2").Range.Column
Row = Cells(Rows.Count, col).End(xlUp).Row
Cells(FirstEmptyRow + 1, col) = Me.textbox1.Value
 

Attachments

  • err.JPG
    err.JPG
    16.2 KB · Views: 17

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top