Private Sub CommandButton1_Click()
'openen excel met ODBC koppeling - bijwerken - sluiten
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open("\\fs1\logistiek\Planlijst_VRE_VRT.xlsx")
objExcel.Workbooks("planlijst_VRE_VRT.xlsx").Worksheets("data_planlijst").ListObjects(1).QueryTable.Refresh False
objExcel.Workbooks("planlijst_VRE_VRT.xlsx").Worksheets("data_chauffeurs").ListObjects(1).QueryTable.Refresh False
objExcel.DisplayAlerts = False
objWorkbook.Close True
objExcel.Quit
Set objExcel = Nothing
'bijwerken query tabblad data in huidige excel
ActiveWorkbook.Connections("Query - data_planlijst").Refresh
ActiveWorkbook.Connections("Query - data_chauffeurs").Refresh
' bijwerken van opmerking met verlof chauffeurs
' Find the last non-blank cell in column A(5)
lRow = Sheets("data").Cells(Rows.Count, 5).End(xlUp).Row
For i = 2 To lRow
If Sheets("data").Cells(i, 9).Value <> "" Then
For y = 2 To lRow
If ((Sheets("data").Cells(y, 5).Value = Sheets("data").Cells(i, 5).Value) And (Sheets("data").Cells(y, 13).Value = Sheets("data").Cells(i, 13).Value)) Then
Sheets("data").Cells(y, 9).Value = Sheets("data").Cells(i, 9).Value
End If
Next y
End If
Next i
[A3:Z2000].ClearContents
Dim ar, ar1, j As Long, k As Long, z As Long
Dim at, at1, t As Long
Dim aq, aq1, q As Long
Dim ao, ao1, o As Long
Dim ax, ax1, x As Long
Dim av, av1, v As Long
Dim sv, b As Long, c00 As String, datum As Date
Dim R As Range
' selectie voor bakwagens
ar = Sheets("data").Cells(1).CurrentRegion
ReDim ar1(UBound(ar), 7)
'selectie voor trekkers
at = Sheets("data").Cells(1).CurrentRegion
ReDim at1(UBound(at), 7)
'selectie voor LZV
aq = Sheets("data").Cells(1).CurrentRegion
ReDim aq1(UBound(aq), 6)
'selectie voor g wagens
ao = Sheets("data").Cells(1).CurrentRegion
ReDim ao1(UBound(ao), 6)
' selectie voor shuttle chauffeurs
ax = Sheets("data").Cells(1).CurrentRegion
ReDim ax1(UBound(ax), 6)
'selectie voor zieken & verlof
av = Sheets("data").Cells(1).CurrentRegion
ReDim av1(UBound(av), 6)