View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default For every empty cell in a column, copy the value from the abovece

Hello

Try this:

Sub FillIn()
Dim TargetCell As Range
Set TargetCell = Range("A2")

Do Until TargetCell.Value = ""
If TargetCell.Offset(1, 0).Value = "" Then
TargetCell.Offset(1, 0) = TargetCell.Value + 1
Set TargetCell = TargetCell.Offset(2, 0)
End If
Loop
End Sub

Regards,
Per

On 22 Nov., 21:31, Charles Robe
wrote:
Good afternoon!

I have a sheet which is keeping track of miscellaneous inventory items. In
Column A, there are several cells with values of even numbers and the cell
directly below that is empty.

What I am trying to achieve is populating the empty cells to have a value of
the cell above it (the even number value cell) plus 1.

In other words, if the value of cell A:2 is 1000, then cell A:3 will be
1001. If the value of cell A:4 is 1200, then cell A:5 will be 1201 and so
forth until the end of the column.

Thank you, in advance, for your help!