Ошибка 1004: ошибка, определяемая приложением или объект-ошибка. Excel
У меня есть sub в Excel 2010, который копирует информацию в ячейки. Когда я пытаюсь запустить его, я получаю «определенную приложением или объектную ошибку»:
With Worksheets("Parameters") .Range(.Cells(line + 3, amountCol), _ .Cells(line + 3, amountCol + 6)).Copy Destination:=amounts End With
Это весь элемент до точки, где происходит ошибка.
Dim numLine As Integer Dim line As Integer Dim allocationType As String Dim allocationRow As Integer Dim specialFund As Integer Dim amountCol As Integer Dim numCol As Integer Dim amounts As Range Dim i As Integer Dim costCol As Integer Dim alloCol As Integer Dim SFcol As Integer SFcol = 38 alloCol = 32 costCol = 34 'set number of allocation lines With Worksheets("Parameters") numLine = .Range(.Cells(3, 18), .Cells(3, 18).End(xlDown)).Count - 1 End With 'set allocation starting point allocationRow = 3 'set the amount starting columng With Worksheets("Parameters") numCol = .Range(.Cells(3, 18), .Cells(3, 18).End(xlToRight)).Count - 1 'look for the starting year For line = 1 To numCol If .Cells(3, 18 + line).Value = Worksheets(wks).Cells(2, costCol) Then amountCol = line + 18 Exit For End If Next line End With 'go through each line, if allocation, add For line = 1 To numLine With Worksheets("Parameters") allocationType = .Cells(3 + line, 18).Value End With 'check if needs to be included If InStr(allocationType, Worksheets("Parameters").Cells(6, 7).Value) Then With Worksheets(wks) 'format the type cell .Range(.Cells(allocationRow, alloCol), .Cells(allocationRow, alloCol + 1)).MergeCells = True .Range(.Cells(allocationRow, alloCol), .Cells(allocationRow, alloCol + 1)).HorizontalAlignment = xlLeft 'check if needs color If InStr(allocationType, "Roads") Then .Range(.Cells(allocationRow, alloCol), .Cells(allocationRow, alloCol + 1)).Interior.ColorIndex = 36 ElseIf InStr(allocationType, "Structures") Then .Range(.Cells(allocationRow, alloCol), .Cells(allocationRow, alloCol + 1)).Interior.ColorIndex = 34 Else 'check if special funding color For specialFund = 3 To Worksheets.Count - 2 If InStr(allocationType, Worksheets(specialFund).Name) Then .Range(.Cells(allocationRow, alloCol), .Cells(allocationRow, alloCol + 1)).Interior.ColorIndex = .Cells(2, SFcol + specialFund).Interior.ColorIndex End If Next End If 'add the allocation type .Range(.Cells(allocationRow, alloCol), .Cells(allocationRow, alloCol + 1)) = allocationType .Range(.Cells(allocationRow, alloCol), .Cells(allocationRow, alloCol + 1)).ShrinkToFit = True 'add the amounts range Set amounts = .Range(.Cells(allocationRow, costCol), .Cells(allocationRow, costCol + 6)) End With 'copy amounts With Worksheets("Parameters") .Range(.Cells(line + 3, amountCol), .Cells(line + 3, amountCol + 6)).Copy Destination:=amounts End With
- Ошибка выполнения макроса Excel 1004
- Ошибка проверки времени выполнения # 0 - значение ESP было неправильно сохранено
- Сортировка нескольких ключей в VBA; Ошибка выполнения 450: неправильное количество аргументов или недопустимое присвоение свойств
- Ошибка времени выполнения 1004 над надстройкой Excel: Неизвестный путь к файлу
- Ошибка времени выполнения «7»: Недостаточно памяти
- Ошибка VBA 424 с пустым
- Application.Evaluate Runtime Ошибка Тип ошибки Несоответствие
- проблема вне кода вызывает проблемы внутри кода
- Попытка удалить все листы в рабочей книге, а затем добавить другие листы с помощью VBA
- «Ошибка выполнения 380: недопустимое значение свойства»
- Ошибка времени VBA 1004: Диапазон (""). Код Formula
- При попытке скопировать и вставить
- Ошибка выполнения VBA Application.Caller