Developing Macros

T

Tim Ashcom

Creating a Macro; Simply inserting 4 blank rows between two populated rows.
Here is what I did and it works.

Sub Add4Lines()
Application.ScreenUpdating = False
Do Until ActiveCell.Text = ""
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.Offset(5, 0).Select
Loop
End Sub


Now I need to figure out how to insert blank rows to show in this format
(Column A & B are formated according to above macro. Column C & D is what I
need the new macro for). On Column C, starting at R1 (Row 1), there are two
blank rows before the next populated row at R3. Then two more blank rows and
then R6 is populated with data. Here is where it gets tricky. Between
populated rows R6 & R8, there is a blank row. The format is basically every
2-1/2 rows, there is a populated row. Just scroll down and you will see the
pattern.

Column A Column B Column C
Column D
R1 0.900000036 -4.394664288
R2
R3 1.400000095 25.50197601
R4
R5
R6 1.900000095 -2.563554049 1.900000095 25.50197601
R7
R8 2.400000095 25.52112961
R9
R10
R11 2.900000095 -32.22753525 2.900000095 25.54034042
R12
R13 3.400000095 25.55951309
R14
R15
R16 3.900000095 0.732443988 3.900000095 25.55951309
R17
R18 4.400000095 25.57868385
R18
R20
R21 4.900000095 -2.929775953 4.900000095 25.59783554


If anyone can help me out on this on, it would be greatly appreciated.

Thanks,

Tim Ashcom
 
J

Joel

ry this

Sub Add4Lines()
Application.ScreenUpdating = False
RowCount = 1
Do While Range("A" & RowCount) <> ""
Rows(RowCount + 1).Insert
Rows(RowCount + 1).Insert
Rows(RowCount + 4).Insert
RowCount = RowCount + 5
Loop
End Sub
 
T

Tim Ashcom

Joel,

It worked! Appreciate your help very much since I am a novice when it comes
to developing marcro's.

Thanks again, Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top