Thread
:
Insert row after blank cell encountered
View Single Post
#
5
Posted to microsoft.public.excel.programming
KG Old Wolf
external usenet poster
Posts: 19
Insert row after blank cell encountered
I owe you one Don - you taught a few lessons here.... thank you
Lesson 1 - how to insert the rows -- Yes, IT WORKED!
Lesson 2 - LISTEN TO OTHERS.... you said to go from bottom up, I chose not
to - couldn't get it to work... you did.
Thank you very much,
Ken
"Don Guillett" wrote:
Sub insertblanklineSAS()
finalrow = Cells(Rows.Count, 8).End(xlUp).Row
For i = finalrow To 1 Step -1
If Len(Application.Trim(Cells(i, 6))) < 1 Then
Rows(i + 1).Insert
End If
Next i
End Sub
--
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.
Reply With Quote
KG Old Wolf
View Public Profile
Find all posts by KG Old Wolf