Code works but goes into endless loop and crashes
Hi Howard,
Am Tue, 8 Oct 2013 22:41:43 -0700 (PDT) schrieb Howard:
What the code is doing now is stopping at the first cell with a formula, and returning a 0. So, as the sheet is set up that would be column M. I deleted some formulas in a row and the code goes the the first cell in the row with a formula and returns a 0 or the value from the formula.
sorry for answers delay, but I have been sleeping.
Try:
If Not rngPN Is Nothing Then
For i = 14 To 6 Step -1
If .Cells(rngPN.Row, i) < "" Then
c.Offset(0, 1) = .Cells(rngPN.Row, i)
Exit For
End If
Next
c.Offset(0, 2) = .Cells(rngPN.Row, WorksheetFunction. _
CountBlank(.Range(.Cells(rngPN.Row, 1), .Cells(rngPN.Row, 5))) + 1)
End If
The line with findnext you can delete because the values are unique and
you don't have to find another value
Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
|