hansgrandia
Board Regular
- Joined
- Jan 10, 2015
- Messages
- 53
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]Order
[/TD]
[TD]PO number
[/TD]
[TD]Art number
[/TD]
[TD]Amount
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]1345
[/TD]
[TD]1
[/TD]
[TD]17
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]1345
[/TD]
[TD]2
[/TD]
[TD]18
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]1345
[/TD]
[TD]3
[/TD]
[TD]8
[/TD]
[/TR]
[TR]
[TD]456
[/TD]
[TD]6547
[/TD]
[TD]4
[/TD]
[TD]8
[/TD]
[/TR]
[TR]
[TD]456
[/TD]
[TD]6547
[/TD]
[TD]1
[/TD]
[TD]9
[/TD]
[/TR]
[TR]
[TD]789
[/TD]
[TD]4564
[/TD]
[TD]3
[/TD]
[TD]11
[/TD]
[/TR]
</tbody>[/TABLE]
Hello,
I have got a range of cells which I would like to split to multiple worksheet when a PO number changes (column B) to a new number. There is not a fixed number of rows per PO number (what makes it complicated). Also, I would like to take the same lay-out as the original/current sheet. How to approach?
Appreciated! Hans Grandia Netherlands
<tbody>[TR]
[TD]Order
[/TD]
[TD]PO number
[/TD]
[TD]Art number
[/TD]
[TD]Amount
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]1345
[/TD]
[TD]1
[/TD]
[TD]17
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]1345
[/TD]
[TD]2
[/TD]
[TD]18
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]1345
[/TD]
[TD]3
[/TD]
[TD]8
[/TD]
[/TR]
[TR]
[TD]456
[/TD]
[TD]6547
[/TD]
[TD]4
[/TD]
[TD]8
[/TD]
[/TR]
[TR]
[TD]456
[/TD]
[TD]6547
[/TD]
[TD]1
[/TD]
[TD]9
[/TD]
[/TR]
[TR]
[TD]789
[/TD]
[TD]4564
[/TD]
[TD]3
[/TD]
[TD]11
[/TD]
[/TR]
</tbody>[/TABLE]
Hello,
I have got a range of cells which I would like to split to multiple worksheet when a PO number changes (column B) to a new number. There is not a fixed number of rows per PO number (what makes it complicated). Also, I would like to take the same lay-out as the original/current sheet. How to approach?
Appreciated! Hans Grandia Netherlands
Code:
Sub PurchaseOrderSheet()
Application.ScreenUpdating = False
'Verwijderen van onnodige kolommen (sheet export)
With Sheets("exportdata")
.Columns("D:P").EntireColumn.Delete
.Columns("J:M").EntireColumn.Delete
.Columns("L:AE").EntireColumn.Delete
End With
'De naam van enkele cellen aanpassen
Range("H1").Value = "Geleverd"
Range("I1").Value = "Verschil"
'In te vullen cellen leeg maken
Range("H2:I2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Selection.End(xlUp).Select
'opmaak
ActiveSheet.PageSetup.Orientation = xlLandscape
Rows("1:1").Select
Selection.Font.Bold = True
Range("A1").Select
ActiveCell.CurrentRegion.Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
With Selection.Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Rows("1:1").RowHeight = 30
Range("G1").Select
With Selection
.WrapText = True
End With
Columns("A:K").Select
Columns("A:K").EntireColumn.AutoFit
Range("A1").Select
[code to create multiple sheets based on PO number]
End Sub
Last edited: