Datum
28.01.2007 12:50:02
Erich
Mit folgenden Code lege ich mir Tabellenblätter an.
Public
Sub dat()
Dim iCounter As Integer, iDays As Integer
Dim Range As Date
Application.ScreenUpdating = False
For iCounter = 1 To 31
Worksheets.Add.Move after:=Worksheets(Worksheets.Count)
ActiveSheet.Range("A3").FormulaR1C1 = _
"=IF(NOT(ISERROR(VLOOKUP(R[-2]C,Feiertage,2,0))),VLOOKUP(R[-2]C,Feiertage,2,0),"""")"
ActiveSheet.Name = Format( _
DateSerial(Year(Date), Month(Date), iCounter), _
Format:="dd.mm.yy")
ActiveSheet.Range("A1") = Format( _
DateSerial(Year(Date), Month(Date), iCounter), _
Format:="dd.mm.yyyy")
ActiveSheet.Range("A2").Value = Format( _
DateSerial(Year(Date), Month(Date), iCounter), _
Format:="dddd")
ActiveSheet.Cells.Interior.ColorIndex = 15
If ActiveSheet.Range("A2").Value = "Samstag" Then ActiveSheet.Cells.Interior.ColorIndex = 6
If ActiveSheet.Range("A2").Value = "Sonntag" Then ActiveSheet.Cells.Interior.ColorIndex = 3
Next iCounter
Worksheets(1).Select
Application.ScreenUpdating = True
End Sub
Nun mein Problem.
Das Datum in der Zelle A1 wird als Text eingetragen, brauche es aber als Datum
um die Feiertage entragen zu können.
Mache ich in der Zelle einen Doppelclick ist das Format Datum.
Wo liegt der Fehler, vieleicht kann mir jemand helfen
Gruss Erich