View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default backfill cells with macros

This worked on a small test area:

Sub bckfl()
Dim x, y As Range
lr = Cells(Rows.Count, 1).End(xlUp).Row
i = 2
For Each y In Range("A2:A" & lr)
lc = Cells(i, Columns.Count).End(xlToLeft).Column
For Each x In Range(Cells(i, 1), Cells(i, lc))
If x = "" And x.Offset(0, 1) = "" Then
Range("A" & i, x.End(xlToRight).Offset(0, -1)) = x.End(xlToRight).Value
ElseIf x = "" And x.Offset(0, 1) < "" Then
x.Offset(0, 0) = x.Offset(0, 1).Value
End If

Next x
i = i + 1
Next y
End Sub

Might need some tweaking for your application.

"Jason Hall" wrote:

I am trying to figure out a way to backfill blank cells in Excel on the same
row. For example:

column A B C D

1 x x x o
2 x x o o
3 x x x o

In row 1 I want the information in cell 1D populate the blank cells in
column 1A,1B, and 1C
In row 2 I want the information in cell 2C to poplulate the blank cells in
column 2A and 2B

Ideally, I want Excel to realize that there are blank cells in a row and
fill those blank cells with the first information it finds on that row.