Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
Privacywetgeving
Het is bij Helpmij.nl niet toegestaan om persoonsgegevens in een voorbeeld te plaatsen. Alle voorbeelden die persoonsgegevens bevatten zullen zonder opgaaf van reden verwijderd worden. In de vraag zal specifiek vermeld moeten worden dat het om fictieve namen gaat.
Sub Uitvoeren_naar_AA_Kranen()
Application.ScreenUpdating = False
Workbooks.Add
ActiveWorkbook.SaveAs "G:\LK-Kranen " & Format(Date, "d-mm-yyyy") & ".xls"
Dim bestandopen
bestandopen = Dir("D:\Danny\*")
Do Until bestandopen = ""
If bestandopen = "" Then Exit Do
Workbooks.Open "D:\Danny\" & bestandopen
With ActiveWorkbook.Sheets(1)
.Range("B1:J" & .Cells.SpecialCells(xlLastCell).Row).Copy _
Workbooks("LK-Kranen " & Format(Date, "d-mm-yyyy") & ".xls").Sheets(1).Cells(Rows.Count, 2).End(xlUp).Offset(1)
End With
Application.DisplayAlerts = False
Workbooks(bestandopen).Close True
bestandopen = Dir
Loop
With Workbooks("LK-Kranen " & Format(Date, "d-mm-yyyy") & ".xls")
With .Sheets(1)
On Error Resume Next
.Range("J2:J13000").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
.Range("B3:J13000").Sort Key1:=Range("C2"), Order1:=xlAscending
Workbooks.Open "D:\Lijst_LK's.xls"
Workbooks("Lijst_LK's.xls").Sheets("Blad1").Range("AA1").CurrentRegion.Copy .Range("AA1")
For I = 1 To .Range("C2:C" & .Cells(Rows.Count, 3).End(xlUp).Row).Rows.Count
.Cells(I, 3) = RTrim(.Cells(I, 3))
Next I
.Cells(1).CurrentRegion.AutoFormat Format:=xlRangeAutoFormatClassic1
.Cells.Borders(xlInsideHorizontal).LineStyle = xlNone
.Columns.AutoFit
End With
End With
Workbooks("Lijst_LK's.xls").Close True
Application.DisplayAlerts = True
Dim cl As Range
Dim C As Variant
Dim Rij As Long
sq = "Roepnaam" & "|" & "Machine" & "|" & "Omschrijving" & "|" & "Werkorder" & "|" & "Status" & "|" & "BeginTijdstipGepland" _
& "|" & "EindTijdstipGepland" & "|" & "CapacitaitsgroepID" & "|" & "Werkvoorbereider" & "|"
With Sheets("Blad1")
For Each cl In .Range("C2:C" & .Cells(Rows.Count, 3).End(xlUp).Row)
If cl > 0 Then
Set C = .Range("AA2:AC254").Find(cl, , xlValues, xlWhole)
If Not C Is Nothing Then
kolom = Mid(C.Address, 3, 1)
Select Case kolom
Case "A"
With Sheets("Blad2").Cells(Rows.Count, 3).End(xlUp)
If cl <> naam Then
Rij = .Offset(1).Row
.Offset(1, -2).Resize(, 10).Interior.ColorIndex = 37
.Offset(1, -2) = cl
.Offset(1, -1).Resize(, 9) = Split(sq, "|")
End If
End With
With Sheets("Blad2")
.Cells(Rows.Count, 3).End(xlUp).Offset(1).Resize(, 7) = cl.Resize(, 7).Value
.Range(.Cells(Rij, 1), .Cells(.Cells(Rows.Count, 3).End(xlUp).Row, 10)).Sort .Cells(Rij - 1, 9), , , , , , , xlYes
End With
Case "B"
With Sheets("Blad3").Cells(Rows.Count, 3).End(xlUp)
If cl <> naam Then
Rij = .Offset(1).Row
.Offset(1, -2).Resize(, 10).Interior.ColorIndex = 37
.Offset(1, -2) = cl
.Offset(1, -1).Resize(, 9) = Split(sq, "|")
End If
End With
With Sheets("Blad3")
.Cells(Rows.Count, 3).End(xlUp).Offset(1).Resize(, 7) = cl.Resize(, 7).Value
.Range(.Cells(Rij, 1), .Cells(.Cells(Rows.Count, 3).End(xlUp).Row, 10)).Sort .Cells(Rij - 1, 9), , , , , , , xlYes
End With
Case "C"
With Sheets("Blad4").Cells(Rows.Count, 3).End(xlUp)
If cl <> naam Then
Rij = .Offset(1).Row
.Offset(1, -2).Resize(, 10).Interior.ColorIndex = 37
.Offset(1, -2) = cl
.Offset(1, -1).Resize(, 9) = Split(sq, "|")
End If
End With
With Sheets("Blad4")
.Cells(Rows.Count, 3).End(xlUp).Offset(1).Resize(, 7) = cl.Resize(, 7).Value
.Range(.Cells(Rij, 1), .Cells(.Cells(Rows.Count, 3).End(xlUp).Row, 10)).Sort .Cells(Rij - 1, 9), , , , , , , xlYes
End With
End Select
End If
End If
If Not cl Is Nothing Then
naam = cl
End If
Next cl
For I = .Range("C2:C" & .Cells(Rows.Count, 3).End(xlUp).Row).Rows.Count To 2 Step -1
If .Cells(I, 3) > 0 Then
Set C = .Range("AA2:AC254").Find(.Cells(I, 3), , xlValues, xlWhole)
If Not C Is Nothing Then
.Cells(I, 3).Offset(, -2).Resize(, 10).Delete shift:=xlUp
End If
End If
Next I
End With
Dim wrksht As Worksheet
For Each wrksht In Worksheets
wrksht.Select
Cells.EntireColumn.AutoFit
Next wrksht
Sheets("Blad2").Name = "AA-Kranen"
Sheets("Blad3").Name = "A-Kranen"
Sheets("Blad4").Name = "Andere Kranen"
Application.ScreenUpdating = True
End Sub
Dim wrksht As Worksheet
For Each wrksht In Worksheets
wrksht.Columns.AutoFit
Next wrksht
For I = 1 To .Range("C2:C" & .Cells(Rows.Count, 3).End(xlUp).Row).Rows.Count
.Cells(I, 3) = RTrim(.Cells(I, 3))
Next I
Sub tst()
Dim i As Long, j As Long
With Sheets("Blad1")
For i = 1 To .UsedRange.Rows.Count 'rijen
For j = 1 To .UsedRange.Columns.Count 'kolommen
Cells(i, j) = RTrim(Cells(i, j))
Next j
Next i
End With
End Sub
With Workbooks("LK-Kranen " & Format(Date, "d-mm-yyyy") & ".xls")
With .Sheets(1)
On Error Resume Next
.Range("J2:J13000").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
.Range("B3:J13000").Sort Key1:=Range("C2"), Order1:=xlAscending
Workbooks.Open "D:\Lijst_LK's.xls"
Workbooks("Lijst_LK's.xls").Sheets("Blad1").Range("AA1").CurrentRegion.Copy .Range("AA1")
For i = 1 To .UsedRange.Rows.Count 'rijen
For j = 1 To .UsedRange.Columns.Count 'kolommen
Cells(i, j) = RTrim(Cells(i, j))
Next j
Next i
'For I = 1 To .Range("C2:C" & .Cells(Rows.Count, 3).End(xlUp).Row).Rows.Count
'.Cells(I, 3) = RTrim(.Cells(I, 3))
' Next I
.Cells(1).CurrentRegion.AutoFormat Format:=xlRangeAutoFormatClassic1
.Cells.Borders(xlInsideHorizontal).LineStyle = xlNone
.Columns.AutoFit
End With
'.Close True
End With
On Error GoTo 0
.Range("B3:J13000").Sort Key1:=Range("C2"), Order1:=xlAscending
Workbooks.Open "D:\Lijst_LK's.xls"
Workbooks("Lijst_LK's.xls").Sheets("Blad1").Range("AA1").CurrentRegion.Copy .Range("AA1")
For i = 1 To .UsedRange.Rows.Count 'rijen
For j = 1 To 10 'kolommen
.Cells(i, j) = RTrim(.Cells(i, j))
Next j
Next i
.Range("B2:J" & .Cells.SpecialCells(11).Row).AutoFormat Format:=xlRangeAutoFormatClassic1
.Cells.Borders(xlInsideHorizontal).LineStyle = xlNone
.Columns.AutoFit
End With
.Close True
.Cells(Rows.Count, 3).End(xlUp).Offset(1).Resize(, 7) = cl.Resize(, 7).Value
.Cells(Rows.Count, 3).End(xlUp).Offset(1, -1).Resize(, 10) = cl.Offset(, -1).Resize(, 10).Value
Application.SheetInNewWorkbook = 3
Application.SheetInNewWorkbook = 4
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.