Hello,
As you're getting started, try recording what you're doing in a macro
and then you can see how excel does it. It might not be efficient code,
but it will point you in the right direction.
For this example I recorded inserting 2 or 3 rows at a time to get
this,
Range("A2:A3").Select
Selection.EntireRow.Insert
This inserts new rows in rows 2 and 3 and pushes the old ones to 4 and
5. To use this for your problem, try either using a small FOR loop to
insert 23 rows or select a range that includes 23 rows and insert once.
Here's the FOR loop,
Dim Rng As Range
Dim i As Integer
Set Rng = Range("A2")
For i = 1 To 23
Rng.EntireRow.Insert
Next
Hope that helps,
Dsambo
wrote:
Hi,
I am new to writing macros...I have a few books but I can't seem to
figure this on out. So, I have the following data:
Date Fuel Price
7/1/06 $5.65
7/2/06 $7.00
7/3/06 $6.32
Basically, I need to insert 23 rows under each date (so that i have a
total of 24 rows for each date). Then, I'd like to copy the contents of
the cells above the insertion so that i have a fuel price for every
hour of each date. Does that make sense? I thought this would be
easy...and now I've wasted so much time, I could have done it manually
a million times now!
Thanks!