If you want a way to delete all the similar rows numbers in a go then this article is for you.
In this article we will learn how we can get rid of same row in multiple worksheets through macros.
Question): I want to delete the same row in multiple worksheets using VBA code. What I want is code to delete all the rows in the workbook regardless of how many sheets are present in the current file; I want to delete the selected row number from all the 5 sheets.
First of all let’s enter the similar data in all the worksheets in same location
We need to follow the below steps:
Enter the following code in the standard module:-
Sub DeleteRows()
Dim shtArr, i As Long, xx As Long
shtArr = Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5")
xx = Selection.Row
For i = LBound(shtArr) To UBound(shtArr)
Sheets(shtArr(i)).Rows(xx).EntireRow.Delete
Next i
End Sub
In this case we can delete similar row number using VBA code.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.