From: Aline on
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
From: ozgrid.com on
If IsEmpty(Range("J3")) Then Range("J2").Copy Range("J3")




--
Regards
Dave Hawley
www.ozgrid.com
"Aline" <Aline(a)discussions.microsoft.com> wrote in message
news:21D22A6A-418C-4769-89C7-B74CE36956A6(a)microsoft.com...
> 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

From: Rick Rothstein on
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" <Aline(a)discussions.microsoft.com> wrote in message
news:21D22A6A-418C-4769-89C7-B74CE36956A6(a)microsoft.com...
> 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

From: Dave Peterson on
Are you trying to fill a column with values of the cell above?

Debra Dalgleish explains how:
http://contextures.com/xlDataEntry02.html
and a video
http://www.contextures.com/xlVideos01.html#FillBlanks

(There's code there, too -- if you really want.)

Aline wrote:
>
> 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

--

Dave Peterson