How to add rows to tables using macros
I have created a series of tables (each say 9 columns by 6 rows) below each other in a worksheet. It is the intention to input data into each table, starting at the top row and working down to the bottom. Some of the cells will include functions which are calculated once data is inserted into adjacent cells in that row. At the very bottom of each table there will be a TOTALS row which adds figures from the rows above.
However, once all the rows are completely filled with data I would like the option of adding a new row at the bottom of the table, but above the TOTALS row. This to be done using a Macro button rather than manually adding a row at the bottom and then copying all the functions to corresponding cells below.
So, the question is - How can I insert subsequent rows, using a Macro button, such that they always appear at the bottom of the list, i.e. directly above the TOTALS row. Following on from that, the TOTALS row would have had to recognise the additional row(s) to ensure a correct total is displayed.
But then, moving on from the first table, I may want to add a row to a subsequent table using another macro. How can I do that?
Alternatively, I could provide hidden rows for each table but how could I unhide one row at a time (when each button is pressed)?
Any help appreciated
Add a row to a table using a macro
Do you have an E-mail I could send to?
Graham
1 Attachment(s)
Adding rows to a table using a macro
I've uploaded my spreadsheet so that you can have a look at what I am trying to do. You will note that I have a series of tables in which financial information will be put. To keep the initial tables in full view and printable on a sheet of A4 paper I have kept the number of rows in each table to a minimum. However one or all of the tables may need to be increased in size by adding additional rows. I would like to do this by the press of a button. The new row would need to include formulae where appropriate. Presumably each button would need a slightly different formula. I did manage to get a macro of sorts to work but found that if I pressed a button for a higher level table and added a row it caused a problem for buttons further down and the row wasn't added in the remaining tables in exactly the right place, i.e. above the TOTALS row.
NOTE : If adding a row is too difficult then an alternative could involve providing each table with a number of hidden rows, which include the necessary formulae. Maybe then the press of a button could reveal the next hidden row above the TOTALS row. Each button would need to be specific to each table, i.e. Button 1 for Rows 10 to 100 say, where Rows 20 to 100 may be hidden to start with, Button 2 for Rows 101 to 200 with Rows 1015 to 200 to start with etc. etc.
Thanks for your help.
Graham:dunno