Beste helpers en oplossers,
Onderstaand stukje code staat achter mijn werkblad "Weekoverzicht" en doet wat het doen moet, op zich al een aardige prestatie van mijzelf. Wanneer ik in cel "E2" het weeknummer verander worden de gegevens van die week in dit blad geladen vanuit het blad "RIT_Invoer", in het voorbeeld bestand is week 34 en 35 ingevuld (uiteraard fictief).
Nu heb ik het gevoel, doordat het vullen nogal optisch te volgen is, dat dit eigenlijk wel wat sneller zou moeten kunnen.
Wie kan mij op weg helpen met tips en eventuele voorbeelden hoe ik dat het beste kan aanpakken?
Private Sub worksheet_change(ByVal Target As range)
If Target.Address(0, 0) = "E2" Then
range("G5:M21") = ""
With worksheets(3)
x = Array(.[c2], .[c2] + 1, .[c2] + 2, .[c2] + 3, .[c2] + 4, .[c2] + 5, .[d2])
k = 0
For i = 7 To 13
.cells(4, i) = x(k)
With worksheets(2).range("M5:M5000")
Set c0 = .Find(cells(4, i), LookIn:=xlValues)
If Not c0 Is Nothing Then
firstaddress = c0.Address
y = Array(8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25)
For j = 0 To 16
Do
l = j + 5
cells(l, i) = cells(l, i) + c0.Offset(0, y(j))
Set c0 = .FindNext(c0)
If c0 Is Nothing Then
GoTo Genoeg
End If
Loop While c0.Address <> firstaddress
If cells(l, i) = 0 Then
cells(l, i) = ""
End If
Next j
End If
End With
k = k + 1
Next i
End With
End If
If k = 7 Then
Call Invullen
End If
Genoeg:
End Sub