Auto fill down a row without copy and pasting

steve400243

Active Member
Joined
Sep 15, 2016
Messages
429
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello, Wondering about the best way to fill down a column without copy and pasting. I have multiple entries in a column as shown in the attachment. Would like a way to copy down the rows to the next entry then stop and copy down that entry, etc. Hope that makes sense. Thank you!

RFCU4032547
SMCU1221331
BMOU5992301
YMLU9539086
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Alright, then instead of LastRow = 50, try the following:

VBA Code:
LastRow = Range("A1").CurrentRegion.Rows.Count

If any confidential data is in there, edit and delete :)
 
Upvote 0
You should be able to fill them all pretty much at once rather than looping individually through the rows. Something like:

VBA Code:
Sub Fill_Blanks()
  With Range("J2:J" & ActiveSheet.UsedRange.Rows.Count)
    .SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"
    .Value = .Value
  End With
End Sub
 
Upvote 0
You should be able to fill them all pretty much at once rather than looping individually through the rows. Something like:

VBA Code:
Sub Fill_Blanks()
  With Range("J2:J" & ActiveSheet.UsedRange.Rows.Count)
    .SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"
    .Value = .Value
  End With
End Sub
Many Thanks Peter_SSs, I appreciate the Code. Much Quicker. Can you explain this Line for me?

VBA Code:
 .SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"
 
Upvote 0
Many Thanks Peter_SSs, I appreciate the Code. Much Quicker.
You're welcome. Glad to help. :)

Can you explain this Line for me?
Sure. In every blank cell in the column it puts a formula that retrieves the value that is in the cell immediately above it.
So if J2 had a value and then several blank cells, those blank cells would now contain these formulas:
J3 would contain =J2
J4 would contain =J3
J5 would contain =J4
etc

To see it in action, instead of just running that code, put your cursor in the code and press F8 until that line has been processed, then have a look at the cells in column J that were originally blank.
 
Upvote 0
You're welcome. Glad to help. :)


Sure. In every blank cell in the column it puts a formula that retrieves the value that is in the cell immediately above it.
So if J2 had a value and then several blank cells, those blank cells would now contain these formulas:
J3 would contain =J2
J4 would contain =J3
J5 would contain =J4
etc

To see it in action, instead of just running that code, put your cursor in the code and press F8 until that line has been processed, then have a look at the cells in column J that were originally blank.
Thank you again, So much to learn. I appreciate your time to explain that.
 
Upvote 0

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

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