CurrentRegion.SpecialCells?

msquared99

Board Regular
Joined
Mar 8, 2012
Messages
52
I have a spreadsheet that has a name starting in cell A2, then there are 5 blanks, a name (Cell A8), 5 blanks, a name (cell A14), 5 blanks and so on. I want my macro to place the name above into the 5 blanks below to the end of the spreadsheet.

The code I have places the name in all the blanks in all the columns. I only need the name in column A.

Thanks for any help!

Here is the code:

Sub FillIn()
On Error Resume Next
Range("A2").CurrentRegion.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C1"
Range("A2").CurrentRegion.Value = Range("A2").CurrentRegion.Value
End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
try

Code:
With Intersect(Range("A2").CurrentRegion, Range("A:A"))
    .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C1"
    .Value = .Value
End With
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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