Dec 10, 2013
I have a small challenge, where I am trying to fill blank cells with the data from the last populated cell above.
View 1 Replies
However, I need it to be able to automatically recognise when a manual entry has beed actioned down the column and recalculate for below that cell with the new data.
The data in the cell is selected from a drop down. I want it to populate all the cells below, until the next drop down is selected. And automatically repopulate them all when it is selected.
E.g. Cell C8 has the value "DATA" selected, and everything below is autofilled with "DATA", but when I select cell C12 with different drop down list value "VALUE", all the cells below stay as "DATA" because they are obviously no longer blank.
What I need if C9 - C11 to remain filled with 'DATA" and from C13 to auto fill with the newly selected value "VALUE".
Need this to happen for as many rows and data selections from the drop down as needed (endless).
I have used:
Sub FillEmpty() Application.ScreenUpdating = False Application.Calculation = xlManual Dim cell As Range For Each cell In Intersect(Selection, _ ActiveSheet.UsedRange) If Trim(cell) = "" And cell.Row > 1 Then cell.NumberFormat = cell.Offset(-1, 0).NumberFormat cell.Value = cell.Offset(-1, 0).Value End If Next cell Application.Calculation = xlAutomatic 'xlCalculationAutomatic Application.ScreenUpdating = False End Sub
which does the auto fill, but won't change the cells below once one of them has been updated.
Drop down list has 31 possible selections at the moment
Starts at Cell C8
Needs to be flexible enough to add an indeterminate number of rows, and additional items to the drop down selection.