Dit is een subje die ik voor mijn planbord heb geschreven.
Zorg dat je in kolom A een hele reeks met datums.
'## Zet de focus op de cel met de datum van vandaag
'## en indien nodig centreren in het venster
Public Sub GaNaarVandaag(HerstelMarkering, ZetFocus As Boolean)
If ActiveSheet.Name <> "PLANBORD" Then Exit Sub
'Zoek rij voor vandaag
If WeekDay(Date, vbMonday) = 6 Then i = 2 'Het weekend doortrekken
naar maandag
If WeekDay(Date, vbMonday) = 7 Then i = 1
'Postitie in kalender bepalen van de dag van vandaag
For Each c In Range("A2:A300")
If Cells(c.Row, 2).Value > 0 Then ThisWeek = c.Row
If c.Value = Date + i Then Exit For
Next c
ThisDayRow = c.Row
If ThisDayRow = 0 Then Exit Sub
If HerstelMarkering Then GoTo InstellenMarkering
If c.Interior.ColorIndex = 3 Then GoTo FocusThisWeek
'Markering verwijderen
With Range(Cells(2, 4), Cells(c.Row + 1, 55))
.BorderAround LineStyle:=xlContinuous, Weight:=xlThin,
ColorIndex:=2
.Borders(xlInsideHorizontal).Weight = xlThin
.Borders(xlInsideHorizontal).ColorIndex = 2
End With
With Range(Cells(2, 1), Cells(c.Row, 3))
.Interior.ColorIndex = 25
.Borders(xlInsideHorizontal).Weight = xlThin
.Borders(xlInsideHorizontal).ColorIndex = 25
.BorderAround LineStyle:=xlContinuous, Weight:=xlThin,
ColorIndex:=25
End With
InstellenMarkering:
'Instellen markering Vandaag
With Range(Cells(c.Row, 1), Cells(c.Row, 55))
.BorderAround LineStyle:=xlContinuous, Weight:=xlMedium,
ColorIndex:=3
End With
With Range(Cells(c.Row, 1), Cells(c.Row, 3))
.Interior.ColorIndex = 3
End With
FocusThisWeek:
If ZetFocus Then ActiveWindow.ScrollRow = ThisWeek
Exit_GaNaarVandaag:
If EersteKeerVandaag = True Then
OldColumn = 4
OldRow = c.Row
EersteKeerVandaag = False
End If
End Sub
Succes!
Hanno
Het zou ook zonder macro kunnen, maar met voorwaardelijke opmaak.
In dat geval vul je bij voorwaardelijke opmaak de onderstaande formule in en
selecteer je een kleur.
=INTEGER((VANDAAG()-DATUM(JAAR(VANDAAG()-WEEKDAG(VANDAAG()-1)+4);1;3) _
+WEEKDAG(DATUM(JAAR(VANDAAG()-WEEKDAG(VANDAAG()-1)+4);1;3))+5)/7)=C1
Ik heb C1 gebruikt omdat hier de 1 van week 1 stond.
groeten Ernst Schuurman
"Jurriaan" <Jurr...@discussions.microsoft.com> schreef in bericht
news:624D61AC-312A-427A...@microsoft.com...