View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default If the cell is empty, copy the value from a specific cell.

I think this will do what you want...

Sub FillOutTheColumn()
Dim Area As Range, LastRow As Long
On Error Resume Next
LastRow = Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlFormulas).Row
For Each Area In Range("J2:J" & LastRow). _
SpecialCells(xlCellTypeBlanks).Areas
Area.Value = Area(1).Offset(-1).Value
Next
End Sub

--
Rick (MVP - Excel)



"Aline" wrote in message
...
Hi there,

How do I write a macro that will check the cells to see if they are empty.
If the cell J3 is empty, if it will copy the content from J2 onto J3. Do
the
same for J4, J5... J8.

Thanks,
Aline