Sheets("or130a").Select
Cells.Select
Selection.ClearContents
If Range("prenote!d9") = 888 Then
lijstor130apath = Range("[prenotetool.xlsm]substitute!b2")
lijstor130aname = Range("[prenotetool.xlsm]substitute!c2")
Else:
lijstor130apath = Range("[prenotetool.xlsm]substitute!e2")
lijstor130aname = Range("[prenotetool.xlsm]substitute!c2")
End If
Workbooks.Open Filename:=lijstor130apath & lijstor130aname
Sheets("Data").Select
Cells.Select
Selection.Copy
Windows("Prenotetool.xlsm").Activate
Sheets("or130a").Select
Range("A1").Select
ActiveSheet.Paste
Cells.Select
ActiveWorkbook.Worksheets("or130a").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("or130a").Sort.SortFields.Add Key:=Range("F2:F15531") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("or130a").Sort
.SetRange Range("A1:r15531")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A2").Select
Windows(lijstor130aname).Activate
ActiveWindow.Close
'importeer de GADD_OR130b en sorteer deze op postcode
Sheets("or130b").Select
Cells.Select
Selection.ClearContents
If Range("prenote!d9") = 888 Then
lijstor130bpath = Range("[prenotetool.xlsm]substitute!b3")
lijstor130bname = Range("[prenotetool.xlsm]substitute!c3")
Else:
lijstor130bpath = Range("[prenotetool.xlsm]substitute!e3")
lijstor130bname = Range("[prenotetool.xlsm]substitute!c3")
End If
Workbooks.Open Filename:=lijstor130bpath & lijstor130bname
Sheets("Data").Select
Cells.Select
Selection.Copy
Windows("Prenotetool.xlsm").Activate
Sheets("or130b").Select
Range("A1").Select
ActiveSheet.Paste
Cells.Select
ActiveWorkbook.Worksheets("or130b").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("or130b").Sort.SortFields.Add Key:=Range("C2:C11324") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("or130b").Sort.SortFields.Add Key:=Range("B2:B11324") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("or130b").Sort
.SetRange Range("A1:N11324")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Windows(lijstor130bname).Activate
ActiveWindow.Close