SOLVED

Use VBA to Autofill a Row until the end of the number of data in another row

New Contributor

I need some help with the following problem:

 

I need to built a Macro that could make the following thing:

 

The Macro should select the first cell with a value and autofill with the same value until the last row that contain the next value that its different.

 

The thing looks like this:

 

jorgeliber_0-1653444443595.png

 And i want to make this in Macro

 

jorgeliber_1-1653444496683.png

 

Thank you very much in advance,

Liber

3 Replies
best response confirmed by jorgeliber (New Contributor)
Solution

@jorgeliber 

 

Please try this...

 

Sub Autofil()
Dim Rng     As Range
Dim lr      As Long

Application.ScreenUpdating = False

lr = Range("A" & Rows.Count).End(xlUp).Row

On Error Resume Next
Set Rng = Range("X2:X" & lr).SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If Not Rng Is Nothing Then
    Rng.Formula2R1C1 = "=R[-1]C"
    Range("X2:X" & lr).Value = Range("X2:X" & lr).Value
End If

Application.ScreenUpdating = True
End Sub
Thanks for your response. You earn my respect and save my **bleep**.