View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas[_2_] Gary Keramidas[_2_] is offline
external usenet poster
 
Posts: 364
Default Problem with Deletion

maybe something like this, start at the bottom and work up

Sub test()
Dim x As Long
Dim lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
'Delete 1 Values from Date Column
x = lastrow
Do While Cells(x, 1).Value < "" And x 1
If Cells(x, 1) = "1" Then
Range("A" & x).Delete Shift:=xlUp
x = x - 1
Else
x = x - 1
End If
Loop

End Sub

--


Gary Keramidas


"Ben" wrote in message
...
I am trying to delete all the 1's from column A, just those cells though,
not
the whole row. I am getting error 1004 on the Selection.Delete line. It
says
Range Class Failed.

Thanks

'Delete 1 Values from Date Column
x = 2
Do While Cells(x, 1).Value < ""
If Cells(x, 1) = "1" Then
Range("A" & x).Select
Selection.Delete Shift:=x1Up
x = x + 1
Else
x = x + 1
End If
Loop

Thanks