Hi guys
I have an excel sheet where the first column consists of Cells containing values and blank cells. I am trying to get the macro to go through that column (from top to bottom) and if the the cell has a value in it copy that value, then go to the next cell, and if it is blank paste that value, or if it has its own value copy that.
i.e. go from this:
x
blank
blank
blank
y
z
blank
To this:
x
x
x
x
y
z
z
Currently the code I have copies the values with no problem (I think), but I cannot get it to paste it if the cell is blank. Heres my code so far:
Any help is very much appreciated
Thanks!
I have an excel sheet where the first column consists of Cells containing values and blank cells. I am trying to get the macro to go through that column (from top to bottom) and if the the cell has a value in it copy that value, then go to the next cell, and if it is blank paste that value, or if it has its own value copy that.
i.e. go from this:
x
blank
blank
blank
y
z
blank
To this:
x
x
x
x
y
z
z
Currently the code I have copies the values with no problem (I think), but I cannot get it to paste it if the cell is blank. Heres my code so far:
Code:
Sub CopyPaste()
Set Rng1 = Range("A3:A65536")
Dim a As Object
For Each a In Rng1.Cells
If a.Value = "*" Then a.Value.Copy
If a.Cell = "" Then
Next a
End Sub
Any help is very much appreciated
Thanks!