LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Populate one cell with an offset cells contents

Here is what I would like to do in a Macro using Excel 2007.
Search a column of data. Where the first blank cell occurs, look in the cell
above it and copy the data down. This would continue through a range of
cells, or the entire column. I know that I can probably accomplish this
through the use of VLookup and copy/paste but the number of entries that
might be copied could range from a few to a few hundred.
I came up with this (it made sense to me <G) and it doesn't even come close
to working.
Assume that column C has the letters A, B, C, and D in Cells C1, C5, C10,
and C15.
I would like to see the letter A in cells C1:C4, B in C5:C9, C in cells
C10:C14 and D in cells C15:C (the end of the range)

Sub Test ()

For Each cell In Range("C:C")
If cell.Value = "" Then
ActiveCell.Offset(1).Copy
ActiveCell.Paste

End If
Next
End Sub

The result is that the macro is trapped in a loop and hangs Excel forcing a
restart of the application.
 
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
concatenate contents of cells whose contents resemble cell referem cathyh Excel Worksheet Functions 3 May 23rd 09 12:16 PM
Help with displaying the contents of the last populate cell. Pank New Users to Excel 9 April 4th 07 06:25 PM
Populate cell with letters from other cells ERudy Excel Discussion (Misc queries) 3 May 16th 06 05:09 PM
Need to get contents of one cell to populate into other(s). YellowBird Excel Programming 5 April 15th 06 11:20 PM
how do populate empty cells with the contents of populated cells . Jim99 Excel Discussion (Misc queries) 6 April 21st 05 05:44 PM


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