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 calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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