Need to delete rows in multiple sheets simultaneously
Closed
ightbet
Posts
1
Registration date
Wednesday May 29, 2019
Status
Member
Last seen
May 29, 2019
-
May 29, 2019 at 11:53 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jun 3, 2019 at 11:52 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jun 3, 2019 at 11:52 AM
Related:
- Need to delete rows in multiple sheets simultaneously
- How to delete multiple files on mac - Guide
- How to delete whatsapp account without login - Guide
- Sheets right to left - Guide
- How to delete a row in a table in word - Guide
- How to make multiple selections in photoshop - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Jun 3, 2019 at 11:52 AM
Jun 3, 2019 at 11:52 AM
Hi Ightbet,
Not sure what you mean by "grouping the sheets", but by selecting all sheets (right-click a sheets tab, Select All Sheets) you can delete rows from all sheets.
But since it is fun to use VBA, here is a code which let you select a range, which is then converted to rows (so the range can be B5:B10, to delete rows 5:10) and then deleted from Sheet1, Sheet2 and Sheet3 (assuming those are actually the sheet names you used):
Even easier would be to select a range and then hit a shortcut to delete those rows from the 3 sheets.
To assign a shortcut, press Alt+F8 to display available macro's, select the macro and then click "Options".
Here is the code for that:
To implement the code(s), press ALT+F11, top menu "Insert", "Module", paste code(s) in the big white field.
Best regards,
Trowa
Not sure what you mean by "grouping the sheets", but by selecting all sheets (right-click a sheets tab, Select All Sheets) you can delete rows from all sheets.
But since it is fun to use VBA, here is a code which let you select a range, which is then converted to rows (so the range can be B5:B10, to delete rows 5:10) and then deleted from Sheet1, Sheet2 and Sheet3 (assuming those are actually the sheet names you used):
Sub RunMe() Dim mRange As Range, mSheet As Worksheet Set mRange = Application.InputBox("Select range", Type:=8) Set mSheet = ActiveSheet Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select Rows(mRange.Row & ":" & mRange.Row + mRange.Rows.Count - 1).Select Selection.Delete mSheet.Select End Sub
Even easier would be to select a range and then hit a shortcut to delete those rows from the 3 sheets.
To assign a shortcut, press Alt+F8 to display available macro's, select the macro and then click "Options".
Here is the code for that:
Sub RunMe2() Dim tRow, bRow As Integer, mSheet As Worksheet Set mSheet = ActiveSheet tRow = Selection.Row bRow = Selection.Row + Selection.Rows.Count - 1 Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select Rows(tRow & ":" & bRow).Select Selection.Delete mSheet.Select End Sub
To implement the code(s), press ALT+F11, top menu "Insert", "Module", paste code(s) in the big white field.
Best regards,
Trowa