You can give this a try... it should be close to what you want...
Sub SelectBlanks()
Dim rng As Range
Dim rngAll As Range
Dim l As Long
Set rng = Range("B4:B300")
For l = 1 To 20
If Application.WorksheetFunction.CountBlank(rng) = rng.Cells.Count
Then
If rngAll Is Nothing Then
Set rngAll = rng
Else
Set rngAll = Union(rng, rngAll)
End If
End If
Set rng = rng.Offset(0, 1)
Next l
If Not rngAll Is Nothing Then
rngAll.EntireColumn.Select
If MsgBox("Delete these??", vbYesNo, "Delete") = vbYes Then _
rngAll.EntireColumn.Delete
End If
End Sub
--
HTH...
Jim Thomlinson
"Mona" wrote:
I am looking for vb code to :
check B4:B300 for blank and if so delete entire column (B:B). I can get
that part. What I am having problems with is I have say 20 columns that I
need to check so I need to "select" the all correct columns and then delete.
I would like the code to "select" the column and/or columns that have blank
cells and then delete
thanks