View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Problem with Deletion

I got my code to work I just had to switch the 1 to ell and take out the x=
x+1 from after the endif.

"JLGWhiz" wrote:

Selection.Delete Shift:=x1Up 'Your code
Selection.Delete Shift:=xlUp 'Corrected

Don't know if you have that in your actual code, but "1" (one) won't work
for "l" (ell). That is the first 1 you need to delete.

"Ben" wrote:

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