1
votes

I simply want to use the value in C2 to populate the rest of column C with the same value all the way to the bottom of the data in the sheet.

Sub Testfill1()
'
' Testfill1 Macro
'

'
    Sheets(1).Select
    lngEndRow = lastCellBlock

    Range("C2:C" & lngEndRow).FormulaR1C1 = "1"
End Sub
4

4 Answers

1
votes

I simply want to use the value in C2 to populate the rest of column C with the same value all the way to the bottom of the data in the sheet.

This should do what you want:

Sub FillDown()
    Range("C2", "C" & rows.Count).FillDown
End Sub

If that doesnt work or doesnt answer your question let me know

0
votes

This will find the last row in column C with a value and copy whatever is in C2 down to that cell.

Sub CopyDown()
    Dim ws As Worksheet
    Dim lastRow As Long

    Set ws = ThisWorkbook.Sheets("Sheet1")
    lastRow = ws.Range("C" & ws.Rows.Count).End(xlUp).Row

    ws.Range("C2").Copy ws.Range("C2:C" & lastRow)

End Sub
0
votes

Try below code

Sub Testfill1()

    Dim lastRow As Long
    With Sheets("sheet1")
        lastRow = .Range("C" & .Rows.Count).End(xlUp).Row
        .Range("C2:C" & lastRow).FormulaR1C1 = "1"
    End With

End Sub
0
votes

I simply want to use the value in C2 to populate the rest of column C with the same value all the way to the bottom of the data in the sheet.

I am interpreting "bottom of the data" to mean the extents of your data and not the absolute bottom of the worksheet (the latter being C1048576 in Excel 2007/2010/2013). It isn't clear on whether C2 contains a formula or not so that should likely be left alone and its value stuffed into the remaining cells from C3 down to the extents of the data.

  Range("C3:C" & cells(rows.count, 3).end(xlUp).row) = Range("C2").value