Good afternoon. This is my first question here. Right now, I thank anyone who can guide me.
I made a spreadsheet with some tables (tab "Home", "Format as table"). Then I made a VBA to clear this table and insert new information from a text file. I was using a feature that is identifying the row where the table is through the Range command ("Table Name"). From there, I incremented an accountant who was always giving me the number of the next line. See below:
...
Application.Goto Reference:="NomeDaTabela"
PróximaLinhaDaTabela = Range("NomeDaTabela").Row
For X = 1 To 50 'Simulando os registros de um array
ActiveSheet.Cells(PróximaLinhaDaTabela, 1) = X
PróximaLinhaDaTabela = PróximaLinhaDaTabela + 1
Next
...
It turns out that I, in fact, am not "controlling" the next row in the "TableName" table. I'm tracking the next row of the worksheet ("ActiveSheet"). When I try to add a new row in the table via the Range command ("Table name") .Insert, it inserts a row at the beginning of the table just below the header. I would like it to insert at the end after the other rows of the table If I try to use the Range (CellName) command, it uses the position of the table plus the number of rows entered. That is, the Range command ("TableName") "knows" where the table is located. I just do not know how to reference it.
Has anyone done anything like this?
Thanks in advance.