View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dayton dayton is offline
external usenet poster
 
Posts: 7
Default Macro Question - Variable

For i = LastRow To 1 Step -1
If Not (Range("K" & i).Value Like "911195") Then
Range("K" & i).EntireRow.Delete
End If
Next 'i


This piece of code deletes a row if the value in column "K" is not like
"911195". How can
I change this to delete whatever the value of cell "A2" is? Could I set this
up as a variable?
Each time I run this the value will not always be "911195" that I want to
delete. Currently I
go edit the macro each time.

T.I.A.