View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
CEG CEG is offline
external usenet poster
 
Posts: 29
Default Code to delete columns meeting a condition

I got a "Loop without Do" error.
--
CG


"Dave O" wrote:

I got results with this:

Sub DeleteColumnsGreaterThanH1()
Range("be2").Select
Do While Selection.Column 8
If ActiveCell.Value Range("h1").Value Then
Selection.EntireColumn.Delete
ActiveCell.Offset(0, -1).Select
Loop
End Sub