Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 12
Default Copy Data to Cells, but Stop at Next Non-Empty Cell

I have a spreadsheet with the following data:

Column A Column B
05:00 Item A
Item B
Item C
07:00 Item A
Item B
09:00 Item B
Item C

Each item corresponds with the time in the same block. What I want to
accomplish is have the time move down until it comes to the next
time. Shown below:

05:00 Item A
05:00 Item B
05:00 Item C
07:00 Item A
07:00 Item B
09:00 Item B
09:00 Item C

So it copies the time down until it comes to the next, non-empty
cell. What I'll then do is count the number of item a entries at
specific times (morning vs afternoon) and so on.
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 8,856
Default Copy Data to Cells, but Stop at Next Non-Empty Cell

Highlight the cells in column A from A2 down to the last entry in
column B. Then press F5 (GoTo) and click Special then click on Blanks
- this should now highlight all the blank cells in column A. Begin to
enter a formula by typing = then click on A1 and then do CTRL-Enter.
This will fill the blanks with the value from the cell above.

Hope this helps.

Pete

On Feb 17, 3:18*pm, Fester wrote:
I have a spreadsheet with the following data:

Column A * Column B
05:00 * * * * Item A
* * * * * * * * *Item B
* * * * * * * * *Item C
07:00 * * * * Item A
* * * * * * * * *Item B
09:00 * * * * Item B
* * * * * * * * *Item C

Each item corresponds with the time in the same block. *What I want to
accomplish is have the time move down until it comes to the next
time. *Shown below:

05:00 * * * * Item A
05:00 * * * * Item B
05:00 * * * * Item C
07:00 * * * * Item A
07:00 * * * * Item B
09:00 * * * * Item B
09:00 * * * * Item C

So it copies the time down until it comes to the next, non-empty
cell. *What I'll then do is count the number of item a entries at
specific times (morning vs afternoon) and so on.


  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 11,501
Default Copy Data to Cells, but Stop at Next Non-Empty Cell

Hi,

Right click your sheet tab, view code and paste this in and run it

Sub Stantial()
lastrow = Cells(Cells.Rows.Count, "B").End(xlUp).Row
Set myrange = Range("A1:A" & lastrow)
For Each c In myrange
If c.Offset(1, 0).Value = "" Then
With c.Offset(1, 0)
.Value = c.Value
.NumberFormat = "h:mm"
End With
End If
Next
End Sub

Mike

"Fester" wrote:

I have a spreadsheet with the following data:

Column A Column B
05:00 Item A
Item B
Item C
07:00 Item A
Item B
09:00 Item B
Item C

Each item corresponds with the time in the same block. What I want to
accomplish is have the time move down until it comes to the next
time. Shown below:

05:00 Item A
05:00 Item B
05:00 Item C
07:00 Item A
07:00 Item B
09:00 Item B
09:00 Item C

So it copies the time down until it comes to the next, non-empty
cell. What I'll then do is count the number of item a entries at
specific times (morning vs afternoon) and so on.

  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 12
Default Copy Data to Cells, but Stop at Next Non-Empty Cell

Fantastic.

Your name should read:

Pete
is awesome!


On Feb 17, 10:34*am, Pete_UK wrote:
Highlight the cells in column A from A2 down to the last entry in
column B. Then press F5 (GoTo) and click Special then click on Blanks
- this should now highlight all the blank cells in column A. Begin to
enter a formula by typing = then click on A1 and then do CTRL-Enter.
This will fill the blanks with the value from the cell above.

Hope this helps.

Pete

On Feb 17, 3:18*pm, Fester wrote:

I have a spreadsheet with the following data:


Column A * Column B
05:00 * * * * Item A
* * * * * * * * *Item B
* * * * * * * * *Item C
07:00 * * * * Item A
* * * * * * * * *Item B
09:00 * * * * Item B
* * * * * * * * *Item C


Each item corresponds with the time in the same block. *What I want to
accomplish is have the time move down until it comes to the next
time. *Shown below:


05:00 * * * * Item A
05:00 * * * * Item B
05:00 * * * * Item C
07:00 * * * * Item A
07:00 * * * * Item B
09:00 * * * * Item B
09:00 * * * * Item C


So it copies the time down until it comes to the next, non-empty
cell. *What I'll then do is count the number of item a entries at
specific times (morning vs afternoon) and so on.


  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 8,856
Default Copy Data to Cells, but Stop at Next Non-Empty Cell

Well, thank you for the kind words - glad it worked for you.

Pete

On Feb 17, 3:43*pm, Fester wrote:
Fantastic.

Your name should read:

Pete
is awesome!

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 to stop index match returning data where lookup cell empty Diddy Excel Worksheet Functions 4 January 18th 09 11:09 PM
Copy cell to empty cells below. [email protected] Excel Programming 3 January 6th 08 05:24 AM
Copy Data From Filled to Empty Cells Sheikh Saadi Excel Discussion (Misc queries) 0 November 10th 05 07:21 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:28 PM.

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"