Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Fill/Copy Up to fill blank cells.

I have a list of data in column B. Every few lines there is a blank.
In any instance of a blank cell, I want a code that will copy from the
value from the cell below and paste it into the blank cell.

The opposite of the fill/copy down code that would copy the last
value.

ex:
apples
cherries
blueberries

plums
mangos
kiwi

Desired result:

apples
cherries
blueberries
plums
plums
mangos
kiwi

The code found plums below the blank space so it copies and plugs that
value in.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,696
Default Fill/Copy Up to fill blank cells.

Easy nuf..

In the first blank, type = and hit the down arrow.. creates the reference.

copy this cell, highlight the column..
Edit - Go to - Special - Blanks
Paste
Ta-Da!

"J.W. Aldridge" wrote:

I have a list of data in column B. Every few lines there is a blank.
In any instance of a blank cell, I want a code that will copy from the
value from the cell below and paste it into the blank cell.

The opposite of the fill/copy down code that would copy the last
value.

ex:
apples
cherries
blueberries

plums
mangos
kiwi

Desired result:

apples
cherries
blueberries
plums
plums
mangos
kiwi

The code found plums below the blank space so it copies and plugs that
value in.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Fill/Copy Up to fill blank cells.

Sub Fill_Blanks_From_Below()
Dim rng As Range, ar As Range
Set rng = Columns(2).SpecialCells(xlBlanks)
For Each ar In rng.Areas
ar.Value = ar.Offset(1, 0).Value
Next ar
End Sub

You can do this manually

Select the column then F5SpecialBlansOK

Type an = sign in active blank cell. point or arrow down to cell below and
Hit CTRL + ENTER


Gord Dibben MS Excel MVP

On Wed, 24 Sep 2008 15:16:51 -0700 (PDT), "J.W. Aldridge"
wrote:

I have a list of data in column B. Every few lines there is a blank.
In any instance of a blank cell, I want a code that will copy from the
value from the cell below and paste it into the blank cell.

The opposite of the fill/copy down code that would copy the last
value.

ex:
apples
cherries
blueberries

plums
mangos
kiwi

Desired result:

apples
cherries
blueberries
plums
plums
mangos
kiwi

The code found plums below the blank space so it copies and plugs that
value in.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Fill/Copy Up to fill blank cells.

I had a similar problem last week, only I needed to copy from the cell
above to the blank cells below. Perhaps you can modify this code to
your purposes. Likewise, I'd welcome any suggestions for
improvements.

Sub Copy_down2()
'Copy cell above to current cell and empty cells below
' make the range wider by adjusting the column offset, where 0 =
current
Dim rng_frm As Range, rng_to As Range, intCO As Integer, intLC As Long

intCO = 0 ' column offset
intLC = ActiveSheet.Rows.Count

Do While ActiveCell.Row < intLC
If IsEmpty(ActiveCell) Then
Set rng_frm = Range(Cells(ActiveCell.Row - 1,
ActiveCell.Column).Address _
& ":" & Cells(ActiveCell.Row - 1, ActiveCell.Column +
intCO).Address)
Set rng_to = Range(Cells(ActiveCell.Row,
ActiveCell.Column).Address _
& ":" & IIf(IsEmpty(ActiveCell(2)),
(Cells(ActiveCell.End(xlDown).Row - 1, ActiveCell.Column).Address),
(Cells(ActiveCell.Row, ActiveCell.Column).Address)))

rng_frm.Copy rng_to
Cells(ActiveCell.End(xlDown).Row,
ActiveCell.Column).Select
End If
ActiveCell(2).Select
If ActiveCell.End(xlDown).Row = intLC Then
Exit Sub
End If

Loop

End Sub

On Sep 24, 5:16*pm, "J.W. Aldridge"
wrote:
I have a list of data in column B. Every few lines there is a blank.
In any instance of a blank cell, I want a code that will copy from the
value from the cell below and paste it into the blank cell.

The opposite of the fill/copy down code that would copy the last
value.

ex:
apples
cherries
blueberries

plums
mangos
kiwi

Desired result:

apples
cherries
blueberries
plums
plums
mangos
kiwi

The code found plums below the blank space so it copies and plugs that
value in.


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
FILL IN BLANK CELLS Charles Excel Discussion (Misc queries) 2 August 8th 05 07:07 PM
The fill feature in Excel that gives option to fill or copy KAHelman New Users to Excel 1 July 29th 05 07:47 PM
Copy down - special to fill only the blank cells Mike Excel Discussion (Misc queries) 3 April 18th 05 10:08 PM
Copy value and fill blank spaces below it until new value is encountered? drod[_2_] Excel Programming 4 January 8th 04 08:22 PM
Fill blank cells with 0 Cheri[_2_] Excel Programming 5 December 7th 03 08:45 PM


All times are GMT +1. The time now is 10:07 PM.

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

About Us

"It's about Microsoft Excel"