View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Otto Moehrbach Otto Moehrbach is offline
external usenet poster
 
Posts: 1,090
Default Creating New Lines from original

Balthasar
This macro will do what you want. I assumed that the original data is
in Column A starting in row 2 with row 1 being headers. Note that the sheet
with the original data must be the active sheet (the sheet on the screen).
I chose a sheet name of "Two" for the destination sheet. Sheet 2 also has
headers in row 1. This sheet name ("Two") is written in the macro so you
must change that name in the macro to your actual sheet name. HTH Otto
Sub DoData()
Dim RngColA As Range
Dim i As Range
Dim Dest As Range
With Sheets("Two")
Set Dest = .Range("A2", .Range("A" &
Rows.Count).End(xlUp).Offset(1))
End With
Set RngColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
For Each i In RngColA
If i.Offset(, 2).Value = "Combine" Then
i.Resize(, 2).Copy Dest.Resize(3)
Dest.Offset(, 2).Value = "Dep X"
Dest.Offset(1, 2).Value = "Dep Y"
Dest.Offset(2, 2).Value = "Dep Z"
Set Dest = Dest.Offset(3)
Else
i.Resize(, 2).Copy Dest
Set Dest = Dest.Offset(1)
End If
Next i
End Sub
"Balthasar G"
wrote in message
...

Input Worksheet

Date, Account Number, Combine
Date, Account Number,


Output Worksheet

Date Account Number, Dep X
Date Account Number, Dep Y
Date Account Number, Dep Z
Date Account Number,


--
Balthasar G
------------------------------------------------------------------------
Balthasar G's Profile:
http://www.excelforum.com/member.php...o&userid=37264
View this thread: http://www.excelforum.com/showthread...hreadid=572125