View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Howard Howard is offline
external usenet poster
 
Posts: 536
Default Code works but goes into endless loop and crashes

change to:

If Not rngPN Is Nothing Then

c.Offset(0, 1) = .Cells(rngPN.Row, Columns.Count).End(xlToLeft)

c.Offset(0, 2) = .Cells(rngPN.Row, WorksheetFunction. _

CountBlank(.Range(.Cells(rngPN.Row, 1), .Cells(rngPN.Row, 5))) + 1)

Set rngPN = ws2From_Item.FindNext(rngPN)

End If


Regards

Claus B.


Hi Claus, that seems to take care of the values issue for sure.

I need the line:

c.Offset(0, 1) = .Cells(rngPN.Row, Columns.Count).End(xlToLeft)

to start at column 14 and come to the left from there. There is data on out to the right of column M. Column M would be as far as the returns to the right will go.

So the returns will be the last value to the right of G in any of the rows of cols H, I, J, K, L.

I tried inserting 14 in the line of code to denote where to xlToLeft should start, but to no avail.

The returns from the left of col G work fine.

Howard