mein "geerbtes" Makro läuft ab diesen Monat leider nicht mehr durch und bricht mit folgender Fehlermeldung: Laufzeitfehler 9 - Index liegt ausserhalb des Bereichs ab.
Könnt ihr mir da helfen?
in der zeile Set c = Cells.Find(z, LookIn:=xlPart) bricht er ab.
Private Sub Download_GK_MCC_Click()
Dim c As Range
Dim Anfang As Range
Dim Bericht As Range
Dim wert As Integer
Dim Text As String
Dim Spalte As String
Dim index As String
Dim Zeile As String
Dim x As String
Dim xBericht As Integer
Dim a As Integer
Dim b As Integer
Dim FileExists As Boolean
win = "4.01_SP_HGB_uncons._2007.xls"
pfad = "F:\Controlling\2.1.Konzerncontrolling(OD)\03. SAP-Downloads\10. Gemeinkosten_ZF\"
z = InputBox("Dateiname:", "GK Download")
If Not z = "" Then
Set c = Cells.Find(z, LookIn:=xlPart)
If Not c Is Nothing And (Dir(pfad + z + ".xls") "") Then
Cells(17, c.Column).Select
If Not ActiveCell.Value = "" Then
t = MsgBox("Der Report '" + z + "' wurde schon eingelesen, wollen Sie trotzdem fortfahren?", _
vbOKCancel, "!!! WARNUNG !!!!")
If t = vbOK Then
ActiveWindow.FreezePanes = False
Workbooks.OpenText Filename:=pfad + z + ".XLS" _
, Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier _
:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:= _
False, Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array _
(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), _
Array(8 _
, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1)) _
Windows(z + ".xls").Activate
Set Bericht = Sheets(z).Cells.Find("Berichtszeitraum:", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
xBericht = Bericht.Column + 1
Sheets(z).Cells(Bericht.Row, xBericht).Select
Text = ActiveCell.Value
Set Anfang = Sheets(z).Cells.Find(" Ist " + Text + "/" + Left(Right(z, 7), 4), After:= _
ActiveCell, LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
Windows(win).Activate
Cells(14, c.Column).Select
ActiveCell.FormulaR1C1 = "=Now()"
ActiveCell.Copy
ActiveCell.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Cells(8, c.Column).Select
Spalte = Anfang.Column
Zeile = Anfang.Row - 7
ActiveCell.FormulaR1C1 = "='[" + z + ".XLS]" + z + "'!R" + Zeile + "C" + Spalte
Calculate
ActiveCell.Copy
ActiveCell.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
a = 17
b = c.Column
x = 11
Spalte = Anfang.Column
index = Anfang.Column - 1
Zeile = Anfang.Row + 2
While a
DANKE.
Grüße
Dieter