Repeat the contents of a cell

K

Kaj Pedersen

Hi group,



I want to repeat the contents of a cell to all cells below in the column
provided the cells below are blank.

This operation shall continue until a cell with contents is met. After this
the repetition to all new blanks shall continue with the contents of the new
cell.

Moreover, I want to specify the range in which I want the procedure to work.



I hope someone can help.



Regards

Kaj Pedersen
 
D

Don Guillett

One way. Modify to suit.

Sub fillempties()
For Each c In [k1:k12]
If c = "" Then c.Value = c.Offset(-1)
Next
End Sub
 
W

wolf

Hi Kaj,

select the range and run this macro

Sub fill_empty_cells()
Selection.SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"
Selection.Copy
Selection.PasteSpecial xlPasteValues
End Sub


Wolf
 
D

Don Guillett

Better than my offering but this might be a little shorter & quicker than
copy/paste

Sub fill_empty_cells1()
With Selection
.SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"
.Formula = .Value
End With
End Sub

wolf said:
Hi Kaj,

select the range and run this macro

Sub fill_empty_cells()
Selection.SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"
Selection.Copy
Selection.PasteSpecial xlPasteValues
End Sub


Wolf
wlamik said:
-----Original Message-----
Hi group,



I want to repeat the contents of a cell to all cells below in the column
provided the cells below are blank.

This operation shall continue until a cell with contents is met. After this
the repetition to all new blanks shall continue with the contents of the new
cell.

Moreover, I want to specify the range in which I want the procedure to work.



I hope someone can help.



Regards

Kaj Pedersen


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top