Hi,
Please can someone help me?
I have the following code that fills any blank cells above the last cell with a value and it fills the blank cells above with that value.
At the moment it will fill column G from the bottom up to cell G7.
Example:
If cell G500 has "X" and cell G250 has "Y" in it and I execute the code, the cells from G500:G251 will have a"X" and cells G250:G7 will have a "Y".
I would like the code to still fill the same but I would like it to stop once it sees another value.
Example:
If cell G500 has "X" and cell G250 has "Y" in it and I execute the code, the cells from G500:G251 will have a"X" and then stops.
Here is my code:
Any help would be appreciated.
Regards
Dan
Please can someone help me?
I have the following code that fills any blank cells above the last cell with a value and it fills the blank cells above with that value.
At the moment it will fill column G from the bottom up to cell G7.
Example:
If cell G500 has "X" and cell G250 has "Y" in it and I execute the code, the cells from G500:G251 will have a"X" and cells G250:G7 will have a "Y".
I would like the code to still fill the same but I would like it to stop once it sees another value.
Example:
If cell G500 has "X" and cell G250 has "Y" in it and I execute the code, the cells from G500:G251 will have a"X" and then stops.
Here is my code:
VBA Code:
Sub FillBlanks()
Dim Rng As Range, RngBlanks As Range
Set Rng = Range("G7", Range("G" & Rows.Count).End(xlUp))
On Error Resume Next
Set RngBlanks = Rng.SpecialCells(xlBlanks)
On Error GoTo 0
If Not RngBlanks Is Nothing Then
RngBlanks.FormulaR1C1 = "=R[1]C"
Rng.Value = Rng.Value
End If
End Sub
Any help would be appreciated.
Regards
Dan