Private Sub cmdClose_Click()
Dim lastRow As Integer
Dim ws As Worksheet
Dim cell As Range
Dim i As Long
Dim a, b As Variant
Dim t As Double: t = Timer
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlManual
'first deactivate filters
If ActiveSheet.AutoFilterMode Then
ActiveSheet.AutoFilterMode = False
End If
'then update sheet "export_C"
With Sheets("export_C")
.Visible = True
End With
'STAP 1 HUIDIGE INHOUD VERWIJDEREN
Set ws = Sheets("export_C")
lastRow = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row
If lastRow > 1 Then ws.Rows("2:" & lastRow).Delete
'STAP 2 DE INPUT COPIEREN
With Sheets("input_C")
'eerst voor de werknemer 1
.Range("A3:A367,F3:F367,J3:J367,L3:P367,R3:X367,G3:G367").Copy 'datums
Sheets("export_C").Range("C2").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End With
With Sheets("export_C")
.Select
.Range("A2:A366").Value = "chauffeurs"
.Range("B2:B366").Value = WorksheetFunction.Proper(Sheets("input_C").Range("G1").Value)
a = .Range("R2:R" & .Range("A" & .Rows.Count).End(xlUp).Row)
ReDim b(1 To UBound(a, 1), 1 To 1)
For i = 1 To UBound(a, 1)
If a(i, 1) = "aanwezig" Then b(i, 1) = 1 Else b(i, 1) = 0
Next i
.Range("R2").Resize(UBound(b, 1)).Value = b
End With
Application.Calculation = xlAutomatic
Application.EnableEvents = True
With Sheets("intro")
.Visible = True
.Select
End With
Sheets("input_C").Visible = False
Sheets("export_C").Visible = False
Application.ScreenUpdating = True
MsgBox "That took " & Timer - t & " seconds."
End Sub