View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default SOS VBA Code Emergency: need to copy tell to empty cell direct below where values in adjacent cells in different column are equal to each other.

Sub AAFillrow()
Dim rng As Range
Dim cell As Range
Set rng = Columns(8).SpecialCells(xlBlanks)
For Each cell In rng
If cell.Offset(0, -4).Value = cell.Offset(-1, -4).Value Then
cell.Value = cell.Offset(-1, 0).Value
End If
Next

End Sub

Should do what you want.

--
Regards,
Tom Ogilvy




Steven Rosenberg wrote in message
om...
I have an eight-column Excel (for Mac, but don't think that matters)
sheet (i.e., columns "A" -"H") and am trying to write a macro that
will look down the cells in Column "H" (about 10,000 rows of data)
and, upon finding an empty cell ("target cell"), copy the contents
(text) from the cell directly above that cell IF:

--the "target" cell is empty; AND
--the value of the same-row cells over in column "D" equal each other.

In other words, an example:

IF. in Column "H", Row 26 has a value of "Judge12", and Row 27 is
empty, the macro should copy "Judge 12" from Row 26 to Row 27 in
Column "H"
AS LONG AS Rows 26 and 27 Column "D" both have the same value, e.g.,
"Smith."