Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options | Excel Discussion (Misc queries) | |||
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing | Excel Discussion (Misc queries) | |||
Copy a string text to cell if another cell not empty | Excel Discussion (Misc queries) | |||
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? | Excel Programming | |||
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? | Excel Programming |