Thread: Reply For Ronny
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mudraker[_280_] mudraker[_280_] is offline
external usenet poster
 
Posts: 1
Default Reply For Ronny

ronny


Something went wrong when i was posting my latest reply to you so i a
reposting it as a new message as well as a reply to your origina
message



I am using excel 97 and do not get the same error that you are.

You may be suffering from a broken line wrap command


try this code which is your code with line wrap added in at appropriat
places. This allows a single line of code to be spread over severa
continuose lines



Dim lastrow As Long
Dim row_index As Long

lastrow = ActiveSheet.Cells(Rows.Count, _
"E").End(xlUp).Row

For row_index = lastrow - 1 To 1 Step -1
If Left(Cells(row_index, "D").Value, 4) _
< Left(Cells(row_index + 1, "D").Value, 4) Then
Cells(row_index + 1, "D").Resize(2, 1). _
EntireRow.Insert (xlShiftDown)
Cells(row_index + 1, "C").FormulaR1C1 _
= "=SUMPRODUCT(--(LEFT(R1C4:R[-1]C4,4)" _
& "=LEFT(R[-1]C4,4)),R1C3:R[-1]C3)"
Cells(row_index + 1, "C").Font.ColorIndex = 3
Cells(row_index + 1, "C").Font.Bold = True
Cells(row_index + 1, "C").Font.Size = 14
Cells(row_index + 1, "C").Name = _
Left(Cells(row_index, "D").Value, 4)
End If
Nex

--
Message posted from http://www.ExcelForum.com