A
AndreasHermle
Dear Experts:
below code deletes all the rows that have the string 'NZ' in Column E in all the sheets of the active workbook.
Could somebody please help me to expand this macro ...
.... so that it runs on all the excel-files in a folder (folder picker). There are only excel files in that specific folder.
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub Delete_NZ_From_AllSheets_In_Workbook()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim lastrow As Long, r As Long
For Each Worksheet in ActiveWorkbook.Worksheets
ShtName = Worksheet.Name
Sheets(ShtName).Select
lastrow = ActiveSheet.UsedRange.Rows.Count
For r = lastrow To 1 Step -1
If UCase(Cells(r,5).Value) = "NZ" Then Rows(r).Delete
Next r
Next Worksheet
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
below code deletes all the rows that have the string 'NZ' in Column E in all the sheets of the active workbook.
Could somebody please help me to expand this macro ...
.... so that it runs on all the excel-files in a folder (folder picker). There are only excel files in that specific folder.
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub Delete_NZ_From_AllSheets_In_Workbook()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim lastrow As Long, r As Long
For Each Worksheet in ActiveWorkbook.Worksheets
ShtName = Worksheet.Name
Sheets(ShtName).Select
lastrow = ActiveSheet.UsedRange.Rows.Count
For r = lastrow To 1 Step -1
If UCase(Cells(r,5).Value) = "NZ" Then Rows(r).Delete
Next r
Next Worksheet
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub