Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Copying to blank cells

My column looks like this, I have data in D1, then cells D2:D10 are blank,
then data in D11 and so on. The data is spaced throughout the column
(ie...not always the same # of blank cells between data). Also, the last
cell in the range can vary from week to week. I need to copy the cell that
has data
to all blank cells below it until I get to the next nonblank cell. So if I
have "A" in D1, "B" in D11 and cells D2:D10 are blank, I need to copy "A"
into D2:D10, and then B into D12:D? (however many blank cells are below until
the next cell with data).

I have written something like this to work on a similar worksheet

lr = Cells(Rows.Count, "D").End(xlUp).Row
For Each c In Range("D1:D" & lr)
If c = "" Then c.Value = c.Offset(-1)
Next

but it does not work with blank cells in this worksheet when I changed the
statement to be If c = ""

Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,718
Default Copying to blank cells

Your code works for me. I can only guess that your 'blank cells' are not
truly empty.

--
Jim
"scorpiorc" wrote in message
...
| My column looks like this, I have data in D1, then cells D2:D10 are blank,
| then data in D11 and so on. The data is spaced throughout the column
| (ie...not always the same # of blank cells between data). Also, the last
| cell in the range can vary from week to week. I need to copy the cell
that
| has data
| to all blank cells below it until I get to the next nonblank cell. So if
I
| have "A" in D1, "B" in D11 and cells D2:D10 are blank, I need to copy "A"
| into D2:D10, and then B into D12:D? (however many blank cells are below
until
| the next cell with data).
|
| I have written something like this to work on a similar worksheet
|
| lr = Cells(Rows.Count, "D").End(xlUp).Row
| For Each c In Range("D1:D" & lr)
| If c = "" Then c.Value = c.Offset(-1)
| Next
|
| but it does not work with blank cells in this worksheet when I changed the
| statement to be If c = ""
|
| Any ideas?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Copying to blank cells

See your other thread for more responses.

scorpiorc wrote:

My column looks like this, I have data in D1, then cells D2:D10 are blank,
then data in D11 and so on. The data is spaced throughout the column
(ie...not always the same # of blank cells between data). Also, the last
cell in the range can vary from week to week. I need to copy the cell that
has data
to all blank cells below it until I get to the next nonblank cell. So if I
have "A" in D1, "B" in D11 and cells D2:D10 are blank, I need to copy "A"
into D2:D10, and then B into D12:D? (however many blank cells are below until
the next cell with data).

I have written something like this to work on a similar worksheet

lr = Cells(Rows.Count, "D").End(xlUp).Row
For Each c In Range("D1:D" & lr)
If c = "" Then c.Value = c.Offset(-1)
Next

but it does not work with blank cells in this worksheet when I changed the
statement to be If c = ""

Any ideas?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Copying to blank cells


See response in your other thread.


Gord Dibben MS Excel MVP

On Wed, 6 Dec 2006 09:20:00 -0800, scorpiorc
wrote:

My column looks like this, I have data in D1, then cells D2:D10 are blank,
then data in D11 and so on. The data is spaced throughout the column
(ie...not always the same # of blank cells between data). Also, the last
cell in the range can vary from week to week. I need to copy the cell that
has data
to all blank cells below it until I get to the next nonblank cell. So if I
have "A" in D1, "B" in D11 and cells D2:D10 are blank, I need to copy "A"
into D2:D10, and then B into D12:D? (however many blank cells are below until
the next cell with data).

I have written something like this to work on a similar worksheet

lr = Cells(Rows.Count, "D").End(xlUp).Row
For Each c In Range("D1:D" & lr)
If c = "" Then c.Value = c.Offset(-1)
Next

but it does not work with blank cells in this worksheet when I changed the
statement to be If c = ""

Any ideas?


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
how do I skip blank cells when writing formulas KatB Excel Worksheet Functions 1 July 11th 06 09:53 PM
Counting blank cells until value is reached Dan Excel Worksheet Functions 9 March 1st 06 12:56 PM
Excel inserted 0's in cells linked to blank cells lburg801 Excel Discussion (Misc queries) 5 October 28th 05 11:32 PM
pivot tables reports - altering display of (blank) cells cak Excel Worksheet Functions 1 August 22nd 05 12:39 AM
CONCATENATE problem with blank cells roger_home Excel Discussion (Misc queries) 1 August 17th 05 09:18 PM


All times are GMT +1. The time now is 08:49 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"