Copy/Paste to all Blank rows

Lovelylou79

New Member
Joined
Sep 4, 2017
Messages
37
Hello,

I need to paste my header row into every blank row on my sheet. The header is at Row 2. Each blank row is spaced 5 rows apart.

I've tried several variations of his code, to no success;

ActiveSheet.UsedRange.Select
Dim i As Long
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
For i = Selection.Rows.Count To 1 Step -1
If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
Rows("2").Copy
ActiveCell.PasteSpecial xlPasteAll

End If
Next i
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With

Where am I going wrong?
 
Glad I was able to help you. Come back here to Mr. Excel next time you need additional assistance.
My apologies, I tried MAIT's code again, and it does work beautifully. I must have done something wrong the first few times.
I feel like your head butting icon is directed at numpty's like me.
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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