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

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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,195,699
Messages
6,011,188
Members
441,593
Latest member
kwest3904

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
Top