Link to home
Start Free TrialLog in
Avatar of JohnNZExcel
JohnNZExcelFlag for New Zealand

asked on

Adding 30 rows of new data to an Excel Table using VBA

I have created a procedure to add 30-40 rows (variable number) of data to an existing excel Table.  The procedure needs to transfer the data from one sheet (Import) to another sheet (Database).  The Database sheet is a formatted excel table and the new data needs to be added to the bottom (first available blank row).  I would like help making this copy process consistent and error free. [Note that the date that is copied is formula driven so it needs to be paste special values or directly referenced.

If doing a simple copy and paste the data is transferred but there are warnings about shifting cells below the table down.  When i turned off alerts i had more success but occasional code errors such as incorrect referencing of the table list object.  I found alternative methods where the table was resized using VBA but this also gave occasional errors/behaviour is not consistent.  Any suggestions will be welcomed.
Add-Rows-to-Table-with-VBA.xlsm
SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JohnNZExcel

ASKER

Thanks for the contributions - my question was not thorough enough it seems.  I actually had several columns of formula also in the table and the interaction the VBA had with those formula when new rows were added was the root of the problem.  Adding data with either of the two methods suggested was the easy bit but then excel would be confused as to how to update the table formula and i would get inconsistent error messages.  I have since removed the table format and simply used a dynamic range.  Problem solved.  Thanks again