Hey Montagnard,
Mijn excuses, ben niet helemaal duidelijk geweest.
De code moet enkel lopen nadat de tabel word bijgewerkt, de bijwerking gebeurd telkens via een opdrachtknop dus ik wou de inkleurcode gewoon toevoegen aan de bestaande opdrachtknop na de code om de tabel bij te werken.
Dit is mijn bijwerk-code van de tabel :
Sub geboorten()
Application.ScreenUpdating = False
With Sheets("INDEX_DA-GA")
rijen = .Cells(Rows.Count, 1).End(xlUp).Row
For g = 2 To rijen
If .Cells(g, 14) = "" Then
gslcht = .Cells(g, 1)
stamnaam = .Cells(g, 2)
aktenaam = .Cells(g, 3)
voornaam = .Cells(g, 4)
g_dat = .Cells(g, 5) & "-" & .Cells(g, 6) & "-" & .Cells(g, 7)
g_jaar = .Cells(g, 7)
g_plaats = .Cells(g, 8)
v_vrnm = .Cells(g, 9)
m_naam = .Cells(g, 10)
m_vrnm = .Cells(g, 11)
ouders = .Cells(g, 12)
gezin = .Cells(g, 13)
With Sheets("TOTAAL-DB")
rijen = .Cells(Rows.Count, 1).End(xlUp).Row
gevonden = False
For rij = 2 To rijen
If .Cells(rij, 5) = voornaam And .Cells(rij, 17) = ouders And (.Cells(rij, 6) = "" Or .Cells(rij, 6) = 0) Then
gevonden = True
h_dat = .Cells(rij, 8)
If h_dat <> "" Then h_jaar = CDbl(Right(h_dat, 4))
If h_jaar = "" Then h_jaar = 0
o_dat = .Cells(rij, 10)
If o_dat <> "" Then o_jaar = CDbl(Right(o_dat, 4))
If o_jaar = "" Then o_jaar = 0
If (h_jaar > 0 And g_jaar < h_jaar) Or (o_jaar > 0 And g_jaar <= o_jaar) Then
.Cells(rij, 6) = g_dat
.Cells(rij, 7) = g_plaats
End If
End If
Next rij
If gevonden = False Then
rij = rijen + 1
.Cells(rij, 1) = gslcht
.Cells(rij, 2) = stamnaam
.Cells(rij, 3) = aktenaam
.Cells(rij, 5) = voornaam
.Cells(rij, 6) = g_dat
.Cells(rij, 7) = g_plaats
.Cells(rij, 12) = v_vrnm
.Cells(rij, 13) = m_naam
.Cells(rij, 14) = m_vrnm
.Cells(rij, 17) = ouders
.Cells(rij, 18) = gezin
End If
End With
.Cells(g, 14) = "OK"
End If
Next g
End With
End Sub
groetjes,
BlackDevil