wer kann mir den bitte helfen? Bei folgendem Code werden beim kopieren der Daten von einer Excel-tabelle in die andere meine Datumswerte nicht richtig übertragen. Das makro soll zwar nur die Werte kopieren, jedoch wird mir in der anderen Tabelle ein falsches Datumsformat wieder gegeben:
Statt tt.mm.yyyy wird mm.tt.yyyy übertragen:
Sub export()
Dim ArrayÜberschrift(1 To 32) As Variant, ArrayWerte() As Variant
Dim x As Long, z As Long
Dim i As Long, y As Long, lngSpalte As Long
Dim rSuche As Range, rFinde As Range
'Application.ScreenUpdating = False
With Application
.ScreenUpdating = False
.EnableEvents = False
.ActiveSheet.Unprotect
End With
Workbooks.Open Filename:="ziel.xls" ' Hier Pfad anpassen z.B.Filename:="C: _
ziel_löschen
ThisWorkbook.Activate
For i = 1 To 32
ArrayÜberschrift(i) = ThisWorkbook.Sheets("bericht").Cells(240, i + 29)
Next i
With Workbooks("Ziel.xls").Sheets("LedgerJournalTrans")
Set rFinde = .Range("A1:CM1")
For i = 1 To 32
Set rSuche = rFinde.Find(what:=ArrayÜberschrift(i), LookAt:=xlWhole, LookIn:= _
xlValues)
If Not rSuche Is Nothing Then
For x = 241 To 307
If ThisWorkbook.Sheets("bericht").Cells(x, i + 29).EntireRow.Hidden = False _
Then
ReDim Preserve ArrayWerte(y)
ArrayWerte(y) = ThisWorkbook.Sheets("bericht").Cells(x, i + 29)
y = y + 1
End If
Next x
lngSpalte = rSuche.Column
For z = LBound(ArrayWerte()) To UBound(ArrayWerte())
.Cells(6 + z, lngSpalte) = ArrayWerte(z)
Next z
End If
ReDim ArrayWerte(0)
y = 0
Next i
End With
Workbooks("Ziel.xls").Save
Workbooks("Ziel.xls").Close
Set rSuche = Nothing
Set rFinde = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
.ActiveSheet.Protect
End With
'Application.ScreenUpdating = True
End Sub
Gruß
Maris