Macro skipping even rows
Adam,
Chickened out of recursion eh<VBG?
In your code, I would suggest that you change
Set ColumnB = Range("b2", Range("b" & Rows.Count).End(xlUp).Address)
For Each i In ColumnB
....
Next i
to
cRows = Range("b2", Range("b" & Rows.Count).End(xlUp).row
' this gets the row number of the last line
' so now loop from that row up
For i = cRows To 1 Step -1
....
Next i
Others changes would be needed as you use i as aon object, and use it as
such later on, whereas I am suggesting using it as a numeric counter, so you
would need to get that object some other way.
As an aside, why all this palaver
Dim overwrite As Variant
overwrite = ""
i = newval
i.Offset(0, 3) = overwrite
Why not just
newval.Offset(0,3) = ""
There seems to be an awful lot of unnecessary selecting going on, which
seems to be easy to remove. For instance
i.Offset(0, -1).Select
'copy part number
For Counta = 1 To i.Offset(0, 3).Value
Selection.Copy
Sheets("CRFS_Invintory_Table").Select
If Range("B1").Offset(1, 0).Value = "" Then
Range("B1").Offset(1, 0).Select
Else
Range("B1").End(xlDown).Offset(1, 0).Select
End If
ActiveSheet.Paste
Next Counta
could probably be written as
i.Offset(0, -1).Cop y
'copy part number
For Counta = 1 To i.Offset(0, 3).Value
with Sheets("CRFS_Invintory_Table").
If .Range("B1").Offset(1, 0).Value = "" Then
.Range("B1").Offset(1, 0).Paste
Else
.Range("B1").End(xlDown).Offset(1, 0).Paste
End If
Next Counta
By the way, indent your code, it makes life easier.
--
HTH
-------
Bob Phillips
... looking out across Poole Harbour to the Purbecks
"Adam Ochs" wrote in message
...
Thank you Steve
Where the heck do I put that in my code?
I am trying now but so far no luck.
Adam
-----Original Message-----
Adam,
For x - 1000 to 1 step -1
Next
steve
"Adam Ochs" wrote in message
...
Thanks Bob
I will try to figure out how to get my code to run from
the bottom as that makes the most sence.
Adam
.
|