Hi,
I have a file where i'd like to delete entire column where row #5 is blank. I have below code where it deletes entire column if it is completely blank.
I want to narrow it down and delete entire column if row 5 is blank in the range. Can anyone help me modify the code. My range is from column A through column BM. Thanks
I have a file where i'd like to delete entire column where row #5 is blank. I have below code where it deletes entire column if it is completely blank.
I want to narrow it down and delete entire column if row 5 is blank in the range. Can anyone help me modify the code. My range is from column A through column BM. Thanks
VBA Code:
Sub DeleteBlankColumns()
Dim MyRange As Range
Dim iCounter As Long
Set MyRange = ActiveSheet.UsedRange
For iCounter = MyRange.Columns.Count To 1 Step -1
If Application.CountA(Columns(iCounter).EntireColumn) = 0 Then
Columns(iCounter).Delete
End If
Next iCounter
End Sub