View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Problem incrementing rows

Hi
in my test it started with 112?. Does your data start in row 1 or a
different one?
For the second part to skip empty rows I adapted Bob's solutions (as it
was IMHO the better one):

Sub foo3()
Dim i
Dim row As Range
Dim cell As Range
Dim row_entry As Boolean
row_entry = False
i = 112
For Each row In Rows("1:267")
For Each cell In row.Columns("A:D")
If cell.Value = "PACK" Then
cell.Value = "PACK" & CStr(i)
If Not row_entry Then row_entry = True
End If
Next cell
If row_entry Then
i = i + 2
If i 140 Then i = 0
row_entry = False
End If
Next row
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

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/