Delete or insert rows in a workbook [Solved]

ehsan - Oct 12, 2017 at 09:48 AM - Latest reply: TrowaD 2396 Posts Sunday September 12, 2010Registration dateModeratorStatus July 19, 2018 Last seen
- Oct 12, 2017 at 11:05 AM
Hello,


sir how i can delete or insert rows in a workbook between sheet one & sheet two for example when i insert or delete row in sheet one i want to delete or insert rows in sheet two automatically with the selected range. kindly reply to me on my email id ***@***
See more 

Your reply

1 reply

TrowaD 2396 Posts Sunday September 12, 2010Registration dateModeratorStatus July 19, 2018 Last seen - Oct 12, 2017 at 11:05 AM
-1
Thank you
Hi Ehsan,

Do you know you can select multiple sheets by holding the Ctrl key?

You can also use the following codes:
Sub InsertSelection()
Dim ws As Worksheet
Set ws = ActiveSheet
Sheets(Array("Sheet one", "Sheet two")).Select
Selection.Insert
ws.Select
End Sub

Sub DeleteSelection()
Dim ws As Worksheet
Set ws = ActiveSheet
Sheets(Array("Sheet one", "Sheet two")).Select
Selection.Delete
ws.Select
End Sub 


You can assign codes to buttons or create shortcut keys for easier acces.

Keep in mind that using codes cancels the use of the blue arrows (reverse actions). Selecting multiple sheets with Ctrl key doesn't.

Best regards,
Trowa
Respond to TrowaD