Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default If the cell is empty, copy the value from a specific cell.

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 464
Default If the cell is empty, copy the value from a specific cell.

If IsEmpty(Range("J3")) Then Range("J2").Copy Range("J3")




--
Regards
Dave Hawley
www.ozgrid.com
"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


  #3   Report Post  
Posted to microsoft.public.excel.programming
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default If the cell is empty, copy the value from a specific cell.

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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
Copy a string text to cell if another cell not empty Pasmatos Excel Discussion (Misc queries) 0 November 25th 05 03:54 PM
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? Steven Rosenberg Excel Programming 0 August 5th 03 06:10 AM
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? SROSENYC Excel Programming 1 August 5th 03 04:34 AM


All times are GMT +1. The time now is 11:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"