Hags
Hags

Reputation: 27

How do I fill down the rest of a column in the next available cell?

I am using the following code for assigning a value.

    Sheets("CDGL Data").Range("A" & Rows.Count).End(xlUp).Offset(1).Formula= "April"

I need the "April" to fill down to the rest of my adjacent rows in blank Cells among the Cells that have values in them.

Example: Cell A899 is blank, Cell B899 has a value, Cell C899 has a value "April" needs to be put into that blank cell A899.

Please help!

Upvotes: 0

Views: 93

Answers (1)

Rory
Rory

Reputation: 34075

You can use this:

Dim lStartRow             As Long
Dim lEndRow               As Long
With Sheets("CDGL Data")
    lStartRow = .Range("A" & .Rows.Count).End(xlUp).Row + 1
    lEndRow = Application.Max(.Range("B" & .Rows.Count).End(xlUp).Row, .Range("C" & .Rows.Count).End(xlUp).Row)
    .Range(.Cells(lStartRow, "A"), .Cells(lEndRow, "A")).Value2 = "April"
End With

Upvotes: 1

Related Questions