View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Addition of rows in table with loop

Desmond,

Change

c = c.Offset(3, 0)

To

Set c = c.Offset(3, 0)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"desmondleow " wrote
in message ...
I have the following code to help me insert a row in between

groups of
similar data.
However, it doesn't work after the first row has been inserted.

Could
someone tell me what's wrong with my code?

For Each c In ActiveWorkbook.Worksheets("CITI
GF").Range(myrange.Address)

If Cells(c.Row, 9).Value < Cells(c.Row + 1, 9).Value Then
'Address = c.Address
c.EntireRow.Offset(1, 0).Select
Selection.Insert Shift:=xlDown
'Range("c.Row,c.column").Offset(1, 0).Select
c = c.Offset(3, 0)
End If
Next c


Regards


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