If the cell is empty, copy the value from a specific cell.

A

Aline

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
 
R

Rick Rothstein

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top