Thread: Increase
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Increase

The OP wanted to add one to only the even rows (he said "even cells", but
that is what I think he meant), so the loop counter should start at 2 and
Step 2 needs to be added to the end of your For statement...

Dim lR As Long
With Sheets("Sheet1")
For lR = 2 To .Cells(.Rows.Count, "F").End(xlUp).Row Step 2
If WorksheetFunction.IsNumber(.Cells(lR, "F")) And _
Not .Cells(lR, "F").HasFormula Then
.Cells(lR, "F") = .Cells(lR, "F") + 1
End If
Next
End With

--
Rick (MVP - Excel)


"Nigel" wrote in message
...
Dim lR As Long
With Sheets("Sheet1")
For lR = 1 To .Cells(.Rows.Count, "F").End(xlUp).Row
If WorksheetFunction.IsNumber(.Cells(lR, "F")) And _
Not .Cells(lR, "F").HasFormula Then
.Cells(lR, "F") = .Cells(lR, "F") + 1
End If
Next
End With


--

Regards,
Nigel




"Workbook" wrote in message
...
Is there a code that will scan every even cell in column F for a quantity
and
if it finds a quantity it will add a 1 to the quantity?