Hallo,
habe noch einen überflüssigen Befehl entdeckt:
Sub AddNewValue(wshOutSheet As Worksheet, rngMoney As Range)
Dim rngWrite As Range
Dim rngKreditor As Range
Set rngWrite = Intersect(wshOutSheet.Range("A:A"), wshOutSheet.UsedRange).Offset(rowOffset:=1)
Set rngWrite = wshOutSheet.Cells(wshOutSheet.UsedRange.Rows.Count + 1, 1)
Set rngKreditor = rngMoney.Worksheet.Cells(rngMoney.Row, 3)
rngWrite.Value = rngKreditor.Value
rngWrite.Offset(ColumnOffset:=1).Value = rngKreditor.Offset(ColumnOffset:=1).Value
rngWrite.Offset(ColumnOffset:=2).Value = rngKreditor.Offset(ColumnOffset:=3).Value
rngWrite.Offset(ColumnOffset:=3).Value = rngMoney.Value
rngWrite.Offset(ColumnOffset:=4).Value = rngMoney.EntireColumn.Cells(1, 1).Value
rngWrite.Offset(ColumnOffset:=5).Value = rngMoney.EntireColumn.Cells(2, 1).Value
End Sub
In dieser sub wird die Variable rngWrite zweimal gesetzt. Der erste Befehl kann entfernt werden:
Set rngWrite = Intersect(wshOutSheet.Range("A:A"), wshOutSheet.UsedRange).Offset(rowOffset:=1)
Korrekt muss es so sein:
Sub AddNewValue(wshOutSheet As Worksheet, rngMoney As Range)
Dim rngWrite As Range
Dim rngKreditor As Range
Set rngWrite = wshOutSheet.Cells(wshOutSheet.UsedRange.Rows.Count + 1, 1)
Set rngKreditor = rngMoney.Worksheet.Cells(rngMoney.Row, 3)
rngWrite.Value = rngKreditor.Value
rngWrite.Offset(ColumnOffset:=1).Value = rngKreditor.Offset(ColumnOffset:=1).Value
rngWrite.Offset(ColumnOffset:=2).Value = rngKreditor.Offset(ColumnOffset:=3).Value
rngWrite.Offset(ColumnOffset:=3).Value = rngMoney.Value
rngWrite.Offset(ColumnOffset:=4).Value = rngMoney.EntireColumn.Cells(1, 1).Value
rngWrite.Offset(ColumnOffset:=5).Value = rngMoney.EntireColumn.Cells(2, 1).Value
End Sub
LG, BigBen
|