VBA code to select the bottom left cell of my table!!!!

Pjh5473

New Member
Joined
Jun 11, 2020
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Hi so I have a table on an excel sheet and I am trying to get the table to add a new row, then select the leftmost cell in that new row (because I have a userform and that's where I want to start inputting the data).
Here is my code so far.:
Code:
Private Sub cmdADD_Click( )
Sheets("Database").Activate
ActiveSheet.ListObjects("Table1").ListRows.Add AlwaysInsert=True

?????????????????????????????????????

ActiveCell.Value=txtCompoundRep.Value
ActiveCell.Offset(0,1).Value=txtTA.Value
End Sub
I need help figuring out what goes where all the ?????????????? are that will select the leftmost cell of the newly created row in my table so that the inputs of the userform go where they are supposed to!!!!!
 
Last edited by a moderator:

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.
Hi & welcome to MrExcel.
How about
VBA Code:
   With Sheets("Database").ListObjects("table1").ListRows.Add
      .Range(1).Value = txtCompoundRep.Value
      .Range(2).Value = txtTA.Value
   End With
 
Upvote 0
YESSSS THANK YOU!!!! You are the best. It works. Just for reference I can keep going with range(3) range(4) etc. right? and if I need to skip a cell I can just skip a number???
 
Upvote 0

Forum statistics

Threads
1,215,416
Messages
6,124,772
Members
449,187
Latest member
hermansoa

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