Hi All,
i am very new to excel and VBA/Macro. Yesterday I was given some excellent help with defining some code to create a command button that would delete and insert a row into a table that I had defined. I now want to take this one step further and use the same command button to insert/delete rows from another table I have created in the same sheet.
I have manged to get it working for an insert but not for the delete more through luck than logic. If have attached the code (apologies if I am not supposed to do this). If anyone could help that would be ideal.
![]()
Sub InsertRow() With Intersect(ActiveCell.EntireRow, Range("Table1")) With Intersect(ActiveCell.EntireRow, Range("Table3")) ActiveSheet.Unprotect .Copy .Offset(1).Insert Application.CutCopyMode = False On Error Resume Next .Offset(1).SpecialCells(xlCellTypeConstants).ClearContents On Error GoTo 0 ActiveSheet.Protect End With End With End SubRegards Graham![]()
Sub Delete_Row() With Intersect(ActiveCell.EntireRow, Range("Table1")) ActiveSheet.Unprotect Intersect(ActiveCell.EntireRow, Range("Table1")).Delete Shift:=xlUp ActiveSheet.Protect End With End Sub











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks