View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default return cells below stop when word found

Sub movedata()

RowCount = 1
Do While Range("B" & RowCount) < ""
If Range("B" & RowCount) = "NEW Transaction" Then
Start = RowCount
ColCount = 4
Else
Cells(Start, ColCount) = Range("C" & RowCount)
ColCount = ColCount + 1
End If
RowCount = RowCount + 1
Loop

End Sub


"bwilk77" wrote:

I need help returning data to consecutive columns to the right from rows
below until a certain text string is found in the first column (I'm having
trouble explaining this, hopefully the example will make sense).

Column B of my sheet has either the text strings "NEW Transaction" or
"Additional Data", and there is data in column C. I need to return all the
data in column C that occurs in rows below the string "NEW Transaction" to
adjacent columns in the same row as this text string "NEW Transaction" until
there is another value of "NEW Transaction" in column B.

Example:
Current
B C D E
NEW Transaction 1.1
Additional Data 1.5
Additional Data 1.6
NEW Transaction 1.3
NEW Transaction 1.4
Additional Data 1.2

Desired
B C D E
NEW Transaction 1.1 1.5 1.6
Additional Data 1.5
Additional Data 1.6
NEW Transaction 1.3
NEW Transaction 1.4 1.2
Additional Data 1.2

I am using Excel 2007. Thanks for any help.