Selection.AutoFill = HELP

spcalan

Well-known Member
Joined
Jun 4, 2008
Messages
1,247
I have a column that needs to filling in.

Row 1 may have a number
Rows 2-100 are empty but need row 1's data to be in it.
Then row 101 has something
but row 102-105 are empty.

basically I need to fill in the empty rows with data from a previous row.
( Selection.AutoFill )???
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
See how this works for you...

With Range("A2:A" & Cells(Rows.Count,"A").End(xlup).Row).SpecialCells(xlCellTypeBlanks)
.Formula = "=A1"
.Value = .Value
End With
 
Upvote 0
See how this works for you...

With Range("A2:A" & Cells(Rows.Count,"A").End(xlup).Row).SpecialCells(xlCellTypeBlanks)
.Formula = "=A1"
.Value = .Value
End With

This just took the first 2 rows with data and pasted them down the range of column A.

Hmm, filled it yes,, but not selection autofill, lol.
 
Upvote 0
I am thinking that it might be a ----

Cells(1,1) = value

if cells(2,1) is empty then copypaste "value"
if cells ( 3,1) is empty then copypaste "value"
 
Upvote 0
Hi,

perhaps with this code?

Code:
Sub fill_rows_A()
    Dim arrTmp As Variant
    Dim lngRow As Long
    With Worksheets("Sheet1") 'adapt
        arrTmp = .Range(.Cells(1, 1), .Cells(.Rows.Count, 1).End(xlUp))
        For lngRow = 1 To UBound(arrTmp)
            If arrTmp(lngRow, 1) = "" Then arrTmp(lngRow, 1) = arrTmp(lngRow - 1, 1)
        Next
        .Range(.Cells(1, 1), .Cells(UBound(arrTmp), 1)) = arrTmp
    End With
End Sub
Case_Germany
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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