repeating values until...

bertusavius

Board Regular
Joined
Feb 28, 2008
Messages
82
I'm facing a small problem I can't figure out.


I've got a table and in a particular column there's a number of values. Not all the cells in this column are filled however, so there's an irregular en variable sequence of filled and empty cells in this column.

I would like to let excel repeat the value of the filled cells down the empty cells below the filled cells, without having to use macros.

So for example I'd like to let excel repeat the value in cell a1 in the empty cells below a1 untill there is anonther filled cell in the column. This value will be repeated also until the next filled cell, etc.


I sure hope it's not too cryptic.
Thanx in advance.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
One way:

Highlight the range containing the data.

On the menu bar go Edit > GoTo > Special > Blanks

Enter = and using the up arrow select the cell above, e.g:

=A1

Commit with CONTROL+ENTER
 
Upvote 0
Code:
Public Sub ProcessData()
Const TEST_COLUMN As String = "A"    '<=== change to suit
Dim i As Long
Dim LastRow As Long

    With ActiveSheet
        
        LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
        For i = 2 To LastRow
        
            If .Cells(i, "A").Value = "" Then
            
                .Cells(i, "A").Value = .Cells(i - 1, "A").Value
            End If
        Next i
    End With
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

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