View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Problem incrementing rows

i = 112
For Each row In Rows("1:267")
cn t = 0
For Each cell In row.Columns("A:D")
If cell.Value = "PACK" Then
cell.Value = "PACK" & CStr(i)
cnt = cnt 1
End If
Next cell
If cnt 0 Then
i = i + 2
If i 140 Then i = 0
End If
Next row

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"hotherps " wrote in message
...
Thanks for the help Frank, I'm almost there. It is incrementing properly
but it is going backwards? It begins counting at 136
and if there are any rows without values it is incrementing the rows as
if the values were there

PACK112 PACK112 PACK112 PACK112 PACK112 PACK112
PACK114 PACK114 PACK114 PACK114 PACK114 PACK114
PACK116 PACK116 PACK116 PACK116 PACK116
PACK118 PACK118 PACK118 PACK118
empty row
empty row
empty row
PACK128 PACK128 PACK128 PACK128 PACK128
PACK130 PACK130 PACK130 PACK130

Is there a way to make it only count on rows that have data?


---
Message posted from http://www.ExcelForum.com/