Tag aus Datum
12.10.2005 02:15:58
Stefan
ich habe folgende Frage: Ist es möglich wenn ich in Zelle A1 das Datum in folgendem Format habe ( 21.10.2005 ) das Excel mir dann in Zelle A2 "Freitag"
ausgibt?
Ich möchte dann in VBA folgenden code verwenden:
Private Sub Worksheet_Change(ByVal Target As Range)
Const TARGETRANGE As String = "E3:E100"
Const LISTRANGE As String = "B3:d100"
Dim rngCheck As Range
Dim rngListPart As Range
Dim lngColor As Long
Set rngCheck = _
Intersect(Range(TARGETRANGE), Range(Target.Address))
If rngCheck Is Nothing Then Exit Sub
Application.EnableEvents = False
Select Case Target.Value
Case Is = "Samstag"
lngColor = 3
Case Is = "Sonntag"
lngColor = 3
Case Is = "Montag"
lngColor = 44
etc
Case Is = "Freitag"
lngColor = 44
End Select
Set rngListPart = _
Intersect(Range(LISTRANGE), Target.EntireRow)
rngListPart.Interior.ColorIndex = lngColor
Application.EnableEvents = True
End Sub
Danke im Vorraus
Stefan