Sub test()
With ActiveSheet
.AutoFilterMode = False
With Range("C2", Range("C" & rows.Count).End(xlUp))
.AutoFilter 1, "*No*"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
End Sub
Sub Delete_Columns()
Application.ScreenUpdating = False
Dim c As Range
For Each c In Range("AM2:C2")
If c.Value = "No" Then c.Columns.Delete
Next
Application.ScreenUpdating = True
End Sub
Sub Delete_Columns()
Application.ScreenUpdating = False
Dim c As Range
For Each c In Range("AM2:C2")
If c.Value = "No" Then c.EntireColumn.Delete
Next
Application.ScreenUpdating = True
End Sub
Sub Delete_Columns()
Application.ScreenUpdating = False
Dim x As Long
For x = 39 To 3 Step -1
If Cells(2, x).Value = "No" Then Cells(2, x).EntireColumn.Delete
Next
Application.ScreenUpdating = True
End Sub
That's why I was querying it... try the code below
Code:Sub Delete_Columns() Application.ScreenUpdating = False Dim x As Long For x = 39 To 3 Step -1 If Cells(2, x).Value = "No" Then Cells(2, x).EntireColumn.Delete Next Application.ScreenUpdating = True End Sub