LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default For next do loop issue

Hi,

Here the situation. I am trying to write a macro that will create a row of
percentage under the row of values. Then drop two rows, to the next blank
and repeat until there are no more rows. I have to do this to about 2000
pieces of data and would really rather not do it by hand.

here's what i have.

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 i As Integer
Dim j As Integer
For i = 3 To 401 Step 2
Range("c" & i).Select
' For j = 2 To 400 Step 2
Do
ActiveCell.FormulaR1C1 = "=r[-1]c/r2c2" : would like j to
replace 2 and actually work:
Selection.Style = "Percent"
Selection.NumberFormat = "0.00%"
ActiveCell.Offset(0, 1).Select
Loop Until IsEmpty(ActiveCell.Offset(-1, 0))

'Next j
Next i


End Sub

any advice would be appreaciated. I am new at programing in VBA so, be
gentle.

thanks,
christian
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
loop Wanna Learn Excel Discussion (Misc queries) 14 September 1st 06 12:36 AM
Loop help PaulW Excel Discussion (Misc queries) 0 May 8th 06 04:00 PM
getting out of a if loop rk0909 Excel Discussion (Misc queries) 3 April 11th 06 03:55 PM
Do Loop Noemi Excel Discussion (Misc queries) 0 December 8th 05 10:43 PM
Loop JohnUK Excel Discussion (Misc queries) 1 February 22nd 05 02:50 PM


All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"