View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default For next do loop issue

Row(i).Select
should be rowS()

See if this gives the same result withOUT selections

Sub insertrowsd1()
Dim i As Long
Dim j As Integer
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For i = Cells(Rows.Count, "c").End(xlUp).Row To 2 Step -2
Rows(i).insert
For j = 1 To 17
Cells(i, j) = Format(Cells(i - 1, j) / Cells(i - 1, 2), "0.00%")
Next j
Next i
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Christian Falde" wrote in
message ...
thank you for your responses Paul and Don.

While i didn't end up using either suggestion. Both did stir the thought
process.

here's the end result.

Sub runthis()
'
' Macro1 Macro
' Macro recorded 11/10/2008 by desneaul
'

'
Application.ScreenUpdating = False

Range("B3").Select
Do
ActiveCell.EntireRow.Select
Selection.Insert Shift:=xlDown
ActiveCell.Offset(2, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(0, 0))


Dim j As Variant
Dim i As Variant
For i = 3 To 401 Step 2
For j = 3 To 17
Range("c" & i).Select
Cells(i, j) = Cells(i - 1, j) / Cells(i - 1, 2)
Next j
Row(i).Select
Selection.NumberFormat = "0.00%"

Next i
End Sub


thanks for your suggestions.
christian