![]() |
Deletion of rows where a value is satisfied for all the sheets
Hi,
I am using the following macro to delete the rows where the value is "Total" in Column D. How can I run it for all the Sheets in the Active Workbook Any suggestions or help would be appreciated. Sub DeleteRows() Dim cLastRow As Long Dim i As Long cLastRow = Cells(Rows.Count, "D").End(xlUp).Row For i = cLastRow To 1 Step -1 If Cells(i, "D").Value = "Total" Then Cells(i, "D").EntireRow.Delete End If Next i End Sub TIA Rashid Khan |
Deletion of rows where a value is satisfied for all the sheets
Sub DeleteRows()
Dim cLastRow As Long Dim i As Long Dim sh1 as Worksheet Dim sh as Worksheet set sh1 = Activesheet Application.ScreenUpdating = False for each sh in Activeworkbook.Worksheets sh.Activate cLastRow = Cells(Rows.Count, "D").End(xlUp).Row For i = cLastRow To 1 Step -1 If Cells(i, "D").Value = "Total" Then Cells(i, "D").EntireRow.Delete End If Next i Next sh1.Activate Application.ScreenUpdating = True End Sub -- Regards, Tom Ogilvy "Rashid Khan" wrote in message om... Hi, I am using the following macro to delete the rows where the value is "Total" in Column D. How can I run it for all the Sheets in the Active Workbook Any suggestions or help would be appreciated. Sub DeleteRows() Dim cLastRow As Long Dim i As Long cLastRow = Cells(Rows.Count, "D").End(xlUp).Row For i = cLastRow To 1 Step -1 If Cells(i, "D").Value = "Total" Then Cells(i, "D").EntireRow.Delete End If Next i End Sub TIA Rashid Khan |
Deletion of rows where a value is satisfied for all the sheets
Thank you... You once again saved my day.. You are a real magician
Rashid Khan |
All times are GMT +1. The time now is 08:09 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com