Private Sub CommandButton1_Click()
test_a100
test
CommandButton1.Visible = False
CommandButton1.Enabled = False
End Sub
Sub test_a100()
'
rounding = 3 ' value afronden op 10^ rounding (3 = 10^ 3 = 1000)
' Data range vaststellen
i = 1
Do
i = i + 1
Range("D" & i & "

" & i).Select
a = Selection.Borders(xlEdgeLeft).LineStyle
Loop While a = -4119
i = i - 1
Range("L" & (i + 1) & ":M" & (i + 1)).Select
TotaalBedrag = ActiveCell.Value
'leegmaken
Selection.ClearContents
Range("L" & i & ":L" & i).Select
ActiveCell.Value = TotaalBedrag * -1
' Data sorteren
Range("D2:M" & i).Select
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, Key2:=Range("E2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal
' find the end of the data
Range("D" & i & "

" & i).Select
Do While ActiveCell.Value = ""
Selection.Borders(xlEdgeLeft).LineStyle = 0
i = i - 1
Range("D" & i & "

" & i).Select
Loop
' concept codes naar 4 cijfers brengen
Range("D2

" & i).Select
Selection.NumberFormat = "0000"
' values omrekenen naar 1000-en (+3=1000)
Do While i > 1
Range("L" & i & ":L" & i).Select
a = ActiveCell.Value
'a = a / 1000
a = Round(a / 10 ^ rounding)
ActiveCell.Value = a
i = i - 1
Loop
' Layout corrigeren
' De macro is opgenomen op 21-4-2006 door C.
'
Columns("A:A").ColumnWidth = 26
Rows("1:1").RowHeight = 30
Columns("C:C").ColumnWidth = 1
Columns("F:K").ColumnWidth = 0.2
Columns("D

").ColumnWidth = 9
Columns("E:E").ColumnWidth = 9
Columns("L:L").ColumnWidth = 9
Range("A1:L1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Font.Bold = True
End With
Range("A2:A3").MergeCells = True
Range("A4:A5").MergeCells = True
Range("A6:A7").MergeCells = True
Range("A8:A9").MergeCells = True
Range("A10:A11").MergeCells = True
Range("A12:A13").MergeCells = True
Range("A14:A15").MergeCells = True
Range("A16:A17").MergeCells = True
Range("B2:B3").MergeCells = True
Range("B4:B5").MergeCells = True
Range("B6:B7").MergeCells = True
Range("B8:B9").MergeCells = True
Range("B10:B11").MergeCells = True
Range("B12:B13").MergeCells = True
Range("B14:B15").MergeCells = True
Range("B16:B17").MergeCells = True
Range("A2:A17").Select
Selection.Font.Bold = True
Range("A2:A3").Select
ActiveCell.FormulaR1C1 = "SRF number"
Range("A4:A5").Select
ActiveCell.FormulaR1C1 = "Organization code (Funloc)"
Range("A6:A7").Select
ActiveCell.FormulaR1C1 = "Year"
Range("A8:A9").Select
ActiveCell.FormulaR1C1 = "Period"
Range("A10:A11").Select
ActiveCell.FormulaR1C1 = "Consolidation group"
Range("A12:A13").Select
ActiveCell.FormulaR1C1 = "Currency Code"
Range("A14:A15").Select
ActiveCell.FormulaR1C1 = "Notation amounts"
Range("A16:A17").Select
ActiveCell.FormulaR1C1 = "Notation quantities"
Range("A2:B17").Select
With Selection.Interior
.ColorIndex = 34
End With
Range("B2:B3").Select
ActiveCell.FormulaR1C1 = "'A100"
Range("B4:B5").Select
ActiveCell.FormulaR1C1 = "'129933"
Range("P1

1").Select
a = ActiveCell.Value ' financial period
Range("B6:B7").Select
ActiveCell.FormulaR1C1 = "'" & Mid(a, 1, 4)
Range("B8:B9").Select
ActiveCell.FormulaR1C1 = "'" & Mid(a, 5, 2) & "99"
Range("B10:B11").Select
ActiveCell.FormulaR1C1 = "'670354"
Range("B12:B13").Select
ActiveCell.FormulaR1C1 = "'USD"
Range("B14:B15").Select
ActiveCell.FormulaR1C1 = "'+" & rounding
Range("B16:B17").Select
ActiveCell.FormulaR1C1 = "'+0"
Range("A2:B17").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
End With
Columns("N

").Select
Selection.ClearContents
Range("A1:A1").Select
End Sub
Sub test()
' Data range vaststellen
j = 1
Do
j = j + 1
Range("D" & j & "

" & j).Select
b = Selection.Borders(xlEdgeLeft).LineStyle
Loop While b = -4119
j = j - 1
Do While j > 1
Range("M" & j & ":M" & j).Select
b = ActiveCell.Value
'a = Round(a / 10 ^ rounding)
'b = b / 1000 * 1000
ActiveCell.Value = b
j = j - 1
Loop
End Sub