Excel Copy Down Routine

purceld2

Well-known Member
Joined
Aug 18, 2005
Messages
586
Office Version
  1. 2013
Platform
  1. Windows
I have a task that I have to perform manually on a regular basis, which involves having to copy the data from the above cells to the empty cells below until a new value is in the column.

Below is an example of a before and after would somebody have a routine which could do this automatically.

Thanks in Advance

Excel Workbook
A
1Test 1
2
3
4
5
6
7
8
9Test 2
10
11Test 3
12
13
14
15
16
17
18Test 4
Sheet1



After

Excel Workbook
A
1Test 1
2Test 1
3Test 1
4Test 1
5Test 1
6Test 1
7Test 1
8Test 1
9Test 2
10Test 2
11Test 3
12Test 3
13Test 3
14Test 3
15Test 3
16Test 3
17Test 3
18Test 4
Sheet1
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
try the following bit of code:

Code:
Sub infill()
    On Error GoTo noGaps
    With Range("A1", Cells(Rows.Count, "A").End(xlUp))
        .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=r[-1]"
        .Value = .Value
    End With
noGaps:
End Sub
 
Upvote 0
Try

Code:
Sub FillDown()
Dim LR As Long
LR = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
With Range("A1:A" & LR)
    .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
    .Value = .Value
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,762
Members
452,940
Latest member
rootytrip

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