View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ivanl Ivanl is offline
external usenet poster
 
Posts: 19
Default for...next including if function and or function

Hi Rick,

Thanks for the reply. I am still getting a 1004 runtime error on the line
you pointed out "method range of object global failed"

Also, are there any other shortform ways of referencing the two values?

Thanks for you help,

Ivan

"Rick Rothstein (MVP - VB)" wrote:

The one thing that stands out immediately is your If-Then test. It should
read this way...

If Range(Cells(i, 6)).Value = "long" Or Range(Cells(i, 6)).Value = "CR" Then

Rick


"Ivanl" wrote in message
...
Hi, I do not knwo what is wrong with my code:

sub cleanisup()
Dim i As Long

For i = 1 To 700

If Range(Cells(i, 6)).Value = "long" Or "CR" Then ' if the value is
not
long or CR then
ActiveCell.Rows("1:1").EntireRow.Select 'activate the whole row
Selection.Delete Shift:=xlUp ' delete this activated row


End If

Next i ' test next cell



End Sub