ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add cell value from cell above when cell is empty (https://www.excelbanter.com/excel-programming/371420-add-cell-value-cell-above-when-cell-empty.html)

sverre

Add cell value from cell above when cell is empty
 
Hi

here is my case:

IF CELL value is empty in the area from cells (3,1) to cells (defined
below,6) then I want excel to add the cell value from cell above. This should
continue to and excluding when cells (x,7) has the value "==============="

Is it possible to solve?

Sverre

Tom Ogilvy

Add cell value from cell above when cell is empty
 
Sub FillCells()
Dim rng as Range, ar as Range, cell as Range
Set rng = columns(1).SpecialCells(xlBlanks)
for each ar in rng
for each cell in ar
if cell.row = 3 then
if cell.offset(0,6) < "===============" then
cell.Resize(1,6).Filldown
end if
end if
next
Next
end Sub

Obviously, test this on a copy of your data.

--
Regards,
Tom Ogilvy


"sverre" wrote:

Hi

here is my case:

IF CELL value is empty in the area from cells (3,1) to cells (defined
below,6) then I want excel to add the cell value from cell above. This should
continue to and excluding when cells (x,7) has the value "==============="

Is it possible to solve?

Sverre



All times are GMT +1. The time now is 04:22 PM.

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