View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Delete Row Select Case

It's always good practice to declare your variables--but you don't absolutely
need to.

If you don't declare the variable, then excel/vba will make it a Variant
--just like if you explicitly did: Dim i as Variant

(I thought you wanted column B???)

Little Penny wrote:

I just copied and pasted the code.I just don't understand why the
code worked without dim i as long.

Sub deleteif()
For i = Cells(Rows.count, "c").End(xlUp).Row To 2 Step -1
Select Case UCase(Left(Cells(i, "c"), 2))
Case Is = "X1": Rows(i).Delete
Case Else
End Select
Next i
End Sub

On Sun, 20 Jan 2008 12:11:03 -0600, "Don Guillett"
wrote:


dim i as long
"c" meant column c


--

Dave Peterson