I have this piece of code that assigns numbers to locations. One i
called "Pack" and the other "Ice". Pack has locations 100-145
Ice locations are 124 - 138 (increment by 2).
If Ice is not needed, the code should assign everything to "Pack"
which it does but, In that scenario the incremented numbers are bein
used twice. That can not happen, if a location is used in Ice it need
to be unavailable to Pack, how do I stop the duplicates.
Here is the code and a small example of what it looks like:
i = 100
For Each cell In Range("A1:DD2567")
If cell.Value = "Pack" Then
i = i + 1
For j = 0 To 8
cell.Offset(0, j).Value = "Pack" & CStr(i)
Next j
If i 145 Then i = 100
End If
Next cell
i = 112
For Each cell In Range("A1:DD2567")
If cell.Value = "Ice" Then
i = i + 2
For j = 0 To 8
cell.Offset(0, j).Value = "Ice" & CStr(i)
Next j
If i 136 Then i = 112
End If
Next cell
Pack101 Pack101 Pack101 Pack101 Pack101 Pack101
Pack102 Pack102 Pack102 Pack102 Pack102 Pack102
Pack103 Pack103 Pack103 Pack103 Pack103 Pack103
Pack Pack104 Pack104 Pack104 Pack104 Pack104
Ice114 Ice114 Ice114 Ice114 Ice114 Ice114
Ice116 Ice116 Ice116 Ice116 Ice116 Ice116
Pack Pack105 Pack105 Pack105 Pack105 Pack105
Pack Pack106 Pack106 Pack106 Pack106 Pack106
When Pack gets up to 114 It will assign it to Pack, but it has alread
been assigned to Ice. So it should skip that number.
Thank
--
Message posted from
http://www.ExcelForum.com