How can i autofill cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can i autofill cells, with the textstring above it?
When a cell is blank fill it with the value above it.
When a cell is filled, goto next cell.

Thanks
Taco
 
Sub test()
Dim allcells As Range, cell As Range
For Each cell In Range("a2:a100") 'a1 = error :)
If cell.Value = "" Then
cell.Value = cell.Offset(-1, 0).Value
End If
Next
End Sub

acces
 
On Error Resume Next
set rng = columns(1).specialcells(xlBlanks)
On Error goto 0
if not rng is nothing then
set rng.formula = "=" & rng(1).offset(-1,0).Address(0,0)
for each cell in rng
rng.Formula = rng.Value
Next
End if
Assumes the first cell will not be blank.
 
Back
Top