I am getting 400 error. I was able to run the program once and it worked. However, I get the error now.
Data:
[TABLE="width: 128"]
<colgroup><col width="64" style="width:48pt" span="2"> </colgroup><tbody>[TR]
[TD="width: 128, bgcolor: transparent, colspan: 2"]Original List[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO1[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO2 [/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO3[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO4[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO5[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO6[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO7[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO8[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO9[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO10[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO11[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO12[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO13[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO14[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO15[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO16[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO17[/TD]
[/TR]
</tbody>[/TABLE]
VBA:
Sub Make2Lists()
Dim Ar As Areas
Dim Rng As Range
Dim i As Long, j As Long
Dim Ary As Variant
j = 4
Ary = Array("Planned", "Break Even")
For i = 0 To UBound(Ary)
With Range("A:A")
.Replace Ary(i), True, xlWhole, , False, , False, False
Set Ar = .SpecialCells(xlConstants, xlLogical).Areas
.Replace True, Ary(i), xlWhole, , False, , False, False
End With
For Each Rng In Ar
Rng.Resize(, 2).Copy Cells(Rows.Count, j).End(xlUp).Offset(1)
Next Rng
j = j + 3
Next i
End Sub
Data:
[TABLE="width: 128"]
<colgroup><col width="64" style="width:48pt" span="2"> </colgroup><tbody>[TR]
[TD="width: 128, bgcolor: transparent, colspan: 2"]Original List[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO1[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO2 [/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO3[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO4[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO5[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO6[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO7[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO8[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO9[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO10[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO11[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO12[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO13[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO14[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO15[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Planned [/TD]
[TD="width: 64, bgcolor: transparent"]PO16[/TD]
[/TR]
[TR]
[TD="width: 64, bgcolor: transparent"]Break End [/TD]
[TD="width: 64, bgcolor: transparent"]PO17[/TD]
[/TR]
</tbody>[/TABLE]
VBA:
Sub Make2Lists()
Dim Ar As Areas
Dim Rng As Range
Dim i As Long, j As Long
Dim Ary As Variant
j = 4
Ary = Array("Planned", "Break Even")
For i = 0 To UBound(Ary)
With Range("A:A")
.Replace Ary(i), True, xlWhole, , False, , False, False
Set Ar = .SpecialCells(xlConstants, xlLogical).Areas
.Replace True, Ary(i), xlWhole, , False, , False, False
End With
For Each Rng In Ar
Rng.Resize(, 2).Copy Cells(Rows.Count, j).End(xlUp).Offset(1)
Next Rng
j = j + 3
Next i
End Sub