return cells below stop when word found

B

bwilk77

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.
 
J

joel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top