ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can i autofill cells (https://www.excelbanter.com/excel-programming/288152-how-can-i-autofill-cells.html)

Taco[_2_]

How can i autofill cells
 
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

acces[_4_]

How can i autofill cells
 
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


---
Message posted from http://www.ExcelForum.com/


Tom Ogilvy

How can i autofill cells
 
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.
--
Regards,
Tom Ogilvy

"Taco" wrote in message
...
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





All times are GMT +1. The time now is 11:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com