I have a table in a spreadsheet template with 3 columns with headers. The first row in the table is populated, and the first cell in this row contains a formula, the second and third cells contain data validations. On the row just below the table is a button that runs a macro. I need to insert new rows with cells of data into the table following the first row and above the row containing the button, and use the same formula and data validations being used by the cells in the first row.
Is it possible to insert a new row with new cells in the table below the first row and above any remaining rows in the spreadsheet, and apply the formulas and data validations used by the cells in first row to the cells in new row? Can someone provide an example of how to do this?
This thread would help you to add a row to the table. To add a row above/below, modify the existing code, i.e. get the row Id/Index where the button is, and create a Row object, append Cell objects to it and then callsheetData.InsertAt(newrRow,the position);ORsheetData.InsertAfter(newChild, refChild);Let me know if you need any help on this.
Thank you very much, your example helped me get past the problem I had run into.
If I run into any trouble with some other tabs in the spreadsheet where I need to move stuff around I will ask for help.