```
Option Explicit
Sub KeepGreaterRowsAndColumns()
Dim varWS As Worksheet
Dim varNRows As Long, varNColumns As Long, _
varCurrentRow As Long, varCurrentColumn As Long
Dim varGreater As Long
Dim varRange1 As Range, varRange2 As Range, _
varRange3 As Range, varRange4 As Range
Dim varGreater2
Application.ScreenUpdating = False
Set varWS = Worksheets("YourSheetName")
varCurrentRow = 2
varCurrentColumn = 4
varNRows = varWS.Range("A" & Rows.Count).End(xlUp).Row
varNColumns = varWS.Cells(1, Columns.Count).End(xlToLeft).Column
Set varRange2 = varWS.Range("A" & varCurrentRow & ":A" & varNRows)
Set varRange4 = varWS.Range(Cells(varCurrentRow, 4), _
Cells(varCurrentRow, varNColumns))
EX:
For Each varRange1 In varRange2
varGreater = WorksheetFunction.CountIf(varRange4, ">50")
If Not varGreater > 0 Then
varWS.Rows(varCurrentRow).Delete
varNRows = varWS.Range("A" & Rows.Count).End(xlUp).Row
Set varRange2 = varWS.Range("A" & varCurrentRow & ":A" & varNRows)
Set varRange4 = varWS.Range(Cells(varCurrentRow, 4), _
Cells(varCurrentRow, varNColumns))
If varCurrentRow > varNRows Then GoTo EX2
GoTo EX
End If
For Each varRange3 In varRange4
DoEvents
varGreater2 = varRange3.Value
If varGreater2 > 50 Then varRange3.Interior.Color = _
RGB(255, 199, 206)
Next
varCurrentRow = varCurrentRow + 1
Set varRange4 = varWS.Range(Cells(varCurrentRow, 4), _
Cells(varCurrentRow, varNColumns))
Next
EX2:
Set varRange2 = varWS.Range(Cells(1, varCurrentColumn), _
Cells(1, varNColumns))
Set varRange4 = varWS.Range(Cells(2, varCurrentColumn), _
Cells(varNRows, varCurrentColumn))
EX3:
For Each varRange1 In varRange2
varGreater = WorksheetFunction.CountIf(varRange4, ">50")
If Not varGreater > 0 Then
varWS.Columns(varCurrentColumn).Delete
varNColumns = varWS.Cells(1, Columns.Count).End(xlToLeft).Column
Set varRange2 = varWS.Range(Cells(1, varCurrentColumn), _
Cells(1, varNColumns))
Set varRange4 = varWS.Range(Cells(2, varCurrentColumn), _
Cells(varNRows, varCurrentColumn))
If varCurrentColumn > varNColumns Then GoTo EX4
GoTo EX3
End If
For Each varRange3 In varRange4
DoEvents
varGreater2 = varRange3.Value
If varGreater2 > 50 Then varRange3.Interior.Color = _
RGB(255, 199, 206)
Next
varCurrentColumn = varCurrentColumn + 1
Set varRange4 = varWS.Range(Cells(2, varCurrentColumn), _
Cells(varNRows, varCurrentColumn))
Next
EX4:
varWS.Range("A1").Activate
Application.ScreenUpdating = True
End Sub
```