eigentlich war ich ja ganz stolz, endlich meine Daten aus verschiedenen ungeöffneten Mappen auslesen zu können (zusammengestückelt aus verschiedenen Forums-Beiträgen...Danke an alle!).
Nun aber noch ein klitzekleines (hoffe ich zumindest)Problem:
Code:
Sub DateienEinlesen()
Dim arrFiles As Variant
Dim intRow As Integer, cnt As Integer
Dim strPath As String
strPath = "d:\technik\arbeitszeiterfassung\2003\planung & bau\"
arrFiles = FileArray(strPath, "*.xls")
strPath = WorksheetFunction.Substitute(strPath, "\", "/")
For intRow = 1 To UBound(arrFiles)
With Worksheets(1)
.Cells(intRow + 6, 1).Value = arrFiles(intRow)
.Hyperlinks.Add anchor:=.Cells(intRow + 6, 1), Address:=strPath & .Cells(intRow + 6, 1).Value
.Cells(intRow + 6, 2).FormulaR1C1 = "=SUBSTITUTE(RC[-1],"".xls"","""")"
.Cells(intRow + 6, 3).Value = "='" & strPath & "[" & Cells(intRow + 6, 2) & ".xls]Jahresüberblick'!I5"
.Cells(intRow + 6, 4).Value = "='" & strPath & "[" & Cells(intRow + 6, 2) & ".xls]Jahresüberblick'!D5"
For cnt = 1 To 49
With Worksheets(1)
.Cells(intRow + 6, cnt + 6).Value = "='" & strPath & "[" & Cells(intRow + 6, 2) & ".xls]Jahresüberblick'!F14" (PROBLEM)
End With
Next cnt
End With
Next intRow
End Sub
Ich möchte, das mit sich mit jeder Erhöhung von cnt auch die Zellabfrage in Spalte F erhöht, also F15, F16 etc.
Versuche mit F(13+cnt) oder Cells(cnt+13, 6) schlugen fehl und brachten als Ergebnis #Name?
Weiss jemand ´ne Lösung ???
Freundliche Abendgrüße
Lutz