Copy paste of first row

User4321

New Member
Joined
Jul 15, 2010
Messages
2
Hi All,

I am newbie. I want to copy first row of Excel sheet to be inserted before every cell that satisfies condition.
For example:
Header1 Header2 Header3
1 cell2 cell3
2 cell4 cell5
1 cell6 cell7

Expecting ouput:

Header1 Header2 Header3
1 cell2 cell3
2 cell4 cell5
Header1 Header2 Header3
1 cell6 cell7

In above ouput i want to insert header if value of first column is 1.
Thanks in advance.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Welcome to the MrExcel board!

You didn't say if you were looking for a macro solution or a manual solution. Here is the outline of a manual solution. If you need a macro, try recording these steps for some starting code. If you cannot figure out the detailed steps to follow the instructions below, post back with which version of Excel you are using.

1. Select the data area including headings.

2. Apply AutoFilter.

3. Use the AutoFilter on the first column to show the '1' values.

4. Select all the way from the second '1' value down to the end of the visible data in the first column.

5. Use GoTo|Special to select 'Visible cells only'.

6. Set the AutoFilter back to show all rows.

7. Insert|Rows

8. Now use AutoFilter to filter the first column to 'Blanks'.

9. Copy the headings and select the visible blank area of the table and Paste.

10. Remove the AutoFilter.
 
Upvote 0
Hi Peter,

Yeah i forgot to mention that. Actually i m looking a macro solution as number of rows is around 1000.

Thanks
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

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