Hello roshanvmech,
The macros below work for the static and dynamic sheets and leaves the First and Last sheets alone. It wasn't clear to me from the post or the workbook what to do with the Transfer sheet. If you provide a good example of which cells are to checked, I can then write the code for the macro. Here are the macros' code. These have been added to the attached workbook.
Macros are in the ThisWorkbook Module of the VBA Project
Sub Macro1()
Dim Wks As Worksheet
Dim WksName As String
For Each Wks In Worksheets
WksName = LCase(Wks.Name)
Select Case WksName
Case Is = "first sheet", "last sheet"
' Ignore these sheets.
Case Is = "transfer"
' ???
Case Else
If WksName Like "static*" Then
Call DeleteRows(Wks.Range("A5"))
End If
If WksName Like "dynamic*" Then
Call DeleteRows(Wks.Range("A7"))
End If
End Select
Next Wks
End Sub
Sub DeleteRows(ByRef Rng As Range)
Dim RngEnd As Range
Dim row As Long
Dim Wks As Worksheet
Set Wks = Rng.Parent
Set RngEnd = Wks.Cells(Rows.Count, Rng.Column).End(xlUp)
If RngEnd.row < Rng.row Then Exit Sub
Set Rng = Wks.Range(Rng, RngEnd)
Application.ScreenUpdating = False
For row = Rng.Rows.Count To 1 Step -1
If IsEmpty(Rng.Item(row, 1)) Then
Rng.Cells(row, 1).EntireRow.Delete
End If
Next row
Application.ScreenUpdating = True
End Sub
Bookmarks