stuck on a simple problem =(

danmen

Board Regular
Joined
Jan 15, 2009
Messages
217
yup I've tried coding this and I'm having problems, any help would be grandly appreciated!!

What I'd like to do is that whenever I highlight a range of cells directly
below a target row, then when I launch the macro new rows are inserted
in the highlighted range and the target row is copied over to them

for example:

say I have a row of data on line 1, now I highlight cells A2:B5, I launch the macro and ...

- new rows 2 to 5 are created
- row 1 is copied into rows 2 to 5

note I could have equally chosen C2:I5 OR T2:Z5 to obtain the same results

once again any help would be appreciated!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try this:
Code:
Sub x()
    With Selection.Areas(1)
        If .Row > 1 Then
            .Rows(0).EntireRow.Copy
            .EntireRow.Insert
        End If
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top