View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Insert row after blank cell encountered

Best to work from the bottom up I can't figure out what you are trying to do
for i= cells(rows.count,8).end(xlup).row to 2 step -1

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You send a clear explanation of what you want
3. You send before/after examples and expected results.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"KG Old Wolf" wrote in message
...
I have a large table with infrequent blank cells in a single column. I
want
to located these and insert a new row directly after that blank cell's
row.
This isn't working ....

Sub InsertBlankLine()
'
FinalRow = Cells(Rows.Count, 8).End(xlUp).Row
'
For Counter = 1 To FinalRow
Set curCell = Worksheets("Sheet1").Cells(Counter, 6)
If curCell.Value < 1 Then curCell.Value = FinalRow
'
ActiveCell.Offset(1).EntireRow.Insert Shift:=xlDown
'
Next Counter
End Sub


Row 8 contains the first blank cell condition but the macro inserts 13
blank
rows right after the first row. (13 is the value of FinalRow).

I have spent 4 hours on this trying every combination I can think of.
Your
help is appreciated.