1 Attachment(s)
Solved: Fill empty cell with previous value if condition is met
Hi,
I have a range of data that I would like to fill missing gaps for if a condition is met using the last previous available data point in that column and if it doesn't take up too much time, colour the value/font in say red so that I know it is proxy value (or any other colour).
So for example in the attachment, wherever a cell in column A contains Yes, I would like to fill all empty cells in that given row with the previous available value and highlight it in red.
The first yes occurs in row 10, so I want to check for empty rows, columns H and P contain empty cells, I would like to fill these with the previous entries from row 9 and colour the font red.
The next row with a yes containing missing values is row 40. In column E, the previous cell row 39 is also blank however so I want to fill it with the value from row 38 (or last avaliable value).
Below is what I have so far to select the range, hope someone can help with the rest.
Many Thanks,
Skywalker
[VBA]
Sub Macro1()
Dim lastcell, lastcol As Integer
lastcol = Range("B1").End(xlToRight).Column
lastcell = Range("a10000").End(xlUp).Row
Range(Cells(2, 2), Cells(lastcell, lastcol)).Select
End Sub
[/VBA]