Hi
a little bit kludgy but give it a try
Sub foo()
Dim i
Dim row_count
Dim cell
Dim rng
i = 112
Set rng = Range("A1:DD267")
row_count = rng.Row
For Each cell In Range("A1:DD267")
If row_count < cell.Row Then
row_count = cell.Row
i = i + 2
End If
If cell.Value = "PACK" Then
cell.Value = "PACK" & CStr(i)
End If
If i 140 Then
i = 0
End If
Next cell
End Sub
--
Regards
Frank Kabel
Frankfurt, Germany
This code almost does what I need, but I'm stuck.
When I run this each cell that matches increments by two. I want to
keep the same value for the whole row. Then drop a row and increment
by two on the next row.
Example:
(Do not want)
Pack112 Pack114 Pack116
(Do want)
Pack112 Pack112 Pack112
Pack114 Pack114 Pack114
i = 112
For Each CELL In Range("A1:DD267")
If CELL.Value = "PACK" Then
i = i + 2
CELL.Value = "PACK" & CStr(i)
If i 140 Then i = 0
End If
Next CELL
Thanks
confused:
---
Message posted from http://www.ExcelForum.com/