Deleting specific rows from multiple sheets
Closed
excelss
-
Sep 4, 2015 at 10:43 AM
JDkas Posts 1 Registration date Sunday March 14, 2021 Status Member Last seen March 15, 2021 - Mar 15, 2021 at 07:18 AM
JDkas Posts 1 Registration date Sunday March 14, 2021 Status Member Last seen March 15, 2021 - Mar 15, 2021 at 07:18 AM
Related:
- How to delete multiple sheets in excel
- How to delete multiple files on mac - Guide
- How to delete whatsapp account without login - Guide
- How to open excel sheet in notepad++ - Guide
- Number to words in excel - Guide
- Mark sheet in excel - Guide
2 responses
vcoolio
Posts
1411
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
September 6, 2024
262
Sep 7, 2015 at 03:30 AM
Sep 7, 2015 at 03:30 AM
Hello again Excelss,
I was just thinking that perhaps your ID in Column A of each sheet may not necessarily be in any uniform order. For example, in Sheet 1 an ID may be in row 4, in Sheet 2 the same ID may be in row 8 and in Sheet 3 the same ID may be in row 15.
So to cover this possibility, the following code may be a better option:-
This code will find the same ID in each sheet and delete it from each sheet.
Following is a link to my updated test work book:-
https://www.dropbox.com/s/9ivpm9g330veykj/Excelss%282%29.xlsm?dl=0
Click on the button and an Input Box will appear asking you to type in an ID. Click OK and you're done.
I hope that this helps.
Cheerio,
vcoolio.
I was just thinking that perhaps your ID in Column A of each sheet may not necessarily be in any uniform order. For example, in Sheet 1 an ID may be in row 4, in Sheet 2 the same ID may be in row 8 and in Sheet 3 the same ID may be in row 15.
So to cover this possibility, the following code may be a better option:-
Sub DeleteData() Application.ScreenUpdating = False Dim ws As Worksheet Dim lRow As Long Dim IDRef As String IDRef = InputBox("Please enter the selected ID.") If IDRef = vbNullString Then Exit Sub For Each ws In Worksheets ws.Select lRow = Range("A" & Rows.Count).End(xlUp).Row For Each cell In Range("A2:A" & lRow) If cell = IDRef Then cell.EntireRow.Delete End If Next cell Next ws Application.ScreenUpdating = True Application.CutCopyMode = False Sheet1.Select End Sub
This code will find the same ID in each sheet and delete it from each sheet.
Following is a link to my updated test work book:-
https://www.dropbox.com/s/9ivpm9g330veykj/Excelss%282%29.xlsm?dl=0
Click on the button and an Input Box will appear asking you to type in an ID. Click OK and you're done.
I hope that this helps.
Cheerio,
vcoolio.
Mar 15, 2021 at 07:18 AM
Very interesting, but i have a problem
In my project the "ID" is diferent in each sheet.
how to solve?
Please Help me
Thank you