Samsung6713
Gebruiker
- Lid geworden
- 24 dec 2019
- Berichten
- 209
Goedemorgen,
ik heb de volgende code die ik in meerdere bestanden gebruik.
Echter iedere keer wordt het bestand geopend waarin de code de eerste keer in geschreven is.
Wat klopt er niet aan mij code?
ik heb de volgende code die ik in meerdere bestanden gebruik.
Echter iedere keer wordt het bestand geopend waarin de code de eerste keer in geschreven is.
Wat klopt er niet aan mij code?
Code:
Sub productie_show()
ActiveWorkbook.Worksheets("Productie").Activate
ActiveWorkbook.Worksheets("Productie").ListObjects("tabelproductie").Sort. _
SortFields.Clear
ActiveWorkbook.Worksheets("Productie").ListObjects("tabelproductie").Sort. _
SortFields.Clear
ActiveWorkbook.Worksheets("Productie").ListObjects("tabelproductie").Sort. _
SortFields.Add2 Key:=Range("tabelproductie[chauffeur]"), SortOn:= _
xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Productie").ListObjects("tabelproductie").Sort. _
SortFields.Add2 Key:=Range("tabelproductie[Datum]"), SortOn:=xlSortOnValues _
, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Productie").ListObjects("tabelproductie").Sort. _
SortFields.Add2 Key:=Range("tabelproductie[Kolom3]"), SortOn:= _
xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Productie").ListObjects("tabelproductie").Sort. _
SortFields.Add2 Key:=Range("tabelproductie[volg]"), SortOn:=xlSortOnValues _
, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Productie").ListObjects("tabelproductie").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Active.Worksheets("productie").Protect DrawingObjects:=False, Contents:=True, Scenarios:=False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
With Active.Worksheets("productie")
.Columns("L:S").Hidden = False
.Columns("I").Hidden = True
End With
End Sub