View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
StumpedAgain StumpedAgain is offline
external usenet poster
 
Posts: 192
Default Inserting Rows - Complicated

This should do the trick as long as there aren't any spaces in the B column.
If there are, let me know and I'll figure something else out.

Sub insertrowhere()

Dim cell, cell1 As Range
Set cell = Range("B2")

Do Until cell = ""

Set cell1 = cell.Offset(1, 0)

For i = 1 To cell.Value
cell.Offset(1, 0).EntireRow.Insert
cell.EntireRow.Copy Destination:=cell.Offset(1, 0).EntireRow
Next i

Set cell = cell1

Loop

End Sub
--
-SA


"suestew" wrote:

Actually, I was completely wrong. I was running the macro in a spreadsheet I
had tried to fix manually and I had stopped at row 727 out of exhaustion.

I ran the macro in a new sheet and it worked on the very first row, that is
B2 and filled in the subsequent rows as desired. Yet I want it to execute
the macro for all the rows in my spreadsheet. What should I do? I imagine a
slight edit to the macro would be all it takes but I'm not sure.

"StumpedAgain" wrote:

You'll have to be more specific. What's different about row 727 or 728? Are
you moving on to another portion that needs to be copied down?

--
-SA


"suestew" wrote:

Your plan worked like magic until row 727. Why? I have more rows.