vendredi 27 février 2015

Insert tablerow and paste formula in it

I have a question. The dutch forum coudn't help me out, so i'm posting this here.


I have a protected Excel-sheet with a table in it. Users can add data to the table and insert and deletes rows.


I have already a working VBA to insert (and delete) a row. But i won't copy the formula from the cell above (this case J24).


screenshot: screenshot


The VBA is:



Private Sub CommandButton1_Click() ActiveSheet.Unprotect Password:="password" ActiveSheet.ListObjects("Tabel2").ListRows.Add AlwaysInsert:=True ActiveSheet.Protect Password:="password" End Sub


Private Sub CommandButton2_Click() ActiveSheet.Unprotect Password:="password" ActiveSheet.ListObjects("Tabel2").ListRows(ActiveSheet.ListObjects("Tabel2").ListRows.Count).Delete ActiveSheet.Protect Password:="password" End Sub



What do I have to add to make it work?


Could some-one help me?


Many thanks!!!!


Aucun commentaire:

Enregistrer un commentaire