Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Microsoft Office и VBA программирование > Microsoft Office Excel
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 16.12.2011, 15:51   #1
Patricia
Новичок
Джуниор
 
Регистрация: 16.12.2011
Сообщений: 1
По умолчанию Ошибка application-defined or object-defined error

При выполнении следующей процедуры возникает ошибка на строке
Cells(i, Y + 7).Formula = "=ЕСЛИ(RC[-2]<=0;RC[-1];0)"
Помогите, пожалуйста!

Sub МАКРОС3()
Dim i As Integer
Dim j As Integer
Dim X As Integer
Dim Y As Integer
Dim B As Variant
Dim A As Variant
Dim D As Date
Dim D1 As Date
Dim S As Variant

X = ActiveCell.Row
Y = ActiveCell.Column
i = X

Do While ((ColorIndex(Cells(i, Y))) <> 21)
Cells(i, Y + 6).Value = Cells(i, Y + 1).Value
Cells(i, Y + 6).Interior.ColorIndex = ColorIndex(Cells(i, Y))
Cells(i, Y + 1).Formula = "=MID(RC[-1],SEARCH(""??.??.????"",RC[-1],1),10)"
Cells(i, Y + 1).NumberFormat = "m/d/yyyy"
Cells(i, Y + 2).NumberFormat = "0"
Cells(i, Y + 3).NumberFormat = "m/d/yyyy"
Cells(i, Y + 4).NumberFormat = "m/d/yyyy"
Cells(i, Y + 4).Formula = "=TODAY()"
Cells(i, Y + 5).NumberFormat = "0"
Cells(i, Y + 6).NumberFormat = "#,##0.00"
'Cells(i, Y + 7).NumberFormat = "#,##0.00"
'Cells(i, Y + 8).NumberFormat = "#,##0.00"
'Cells(i, Y + 9).NumberFormat = "#,##0.00"
'Cells(i, Y + 10).NumberFormat = "#,##0.00"
'Cells(i, Y + 11).NumberFormat = "#,##0.00"
'Cells(i, Y + 12).NumberFormat = "#,##0.00"
'Cells(i, Y + 13).NumberFormat = "#,##0.00"
'Cells(i, Y + 14).NumberFormat = "#,##0.00"
Cells(i, Y + 2).Value = 30
If ((ColorIndex(Cells(i, Y))) <> 24) Then
Cells(i, Y + 3).Formula = "=RC[-2]+RC[-1]"
Cells(i, Y + 5).Formula = "=RC[-1]-RC[-2]"
Cells(i, Y + 7).Formula = "=ЕСЛИ(RC[-2]<=0;RC[-1];0)"
Cells(i, Y + 8).Formula = "=ЕСЛИ(И(RC[-3]<=30;RC[-3]>0);RC[-2];0)"
Cells(i, Y + 9).Formula = "=ЕСЛИ(И(RC[-4]<=45;RC[-4]>30);RC[-3];0)"
Cells(i, Y + 10).Formula = "=ЕСЛИ(И(RC[-5]<=45;RC[-5]>30);RC[-4];0)"
Cells(i, Y + 11).Formula = "=ЕСЛИ(И(RC[-6]<=60;RC[-6]>45);RC[-5];0)"
Cells(i, Y + 12).Formula = "=ЕСЛИ(И(RC[-7]<=90;RC[-7]>60);RC[-6];0)"
Cells(i, Y + 13).Formula = "=ЕСЛИ(RC[-8]>90;RC[-7];0)"
Cells(i, Y + 14).Formula = "=RC[-1]+RC[-2]+RC[-3]+RC[-4]+RC[-5]"
i = i + 1
Else: i = i + 1
End If
Loop
j = Y
i = X
Do While ((ColorIndex(Cells(i, Y))) <> 21)
For j = Y + 1 To 14
'A = ColorIndex(Cells(i, x))
'Cells(i, j).Interior.ColorIndex = A
If (ColorIndex(Cells(i, j)) = 24) Then
Cells(i, j).Formula = "=RC[+16]"
End If
Next j
i = i + 1
Loop
'For j = (Y + 6) To 14
'Summa_po_tsvetam (Cells(X, j))
' Next j
End Sub
Patricia вне форума Ответить с цитированием
Старый 16.12.2011, 15:53   #2
Hugo121
Старожил
 
Регистрация: 11.05.2010
Сообщений: 5,166
По умолчанию

.FormulaLocal=
Если пишите формулу на русском - добавляйте Local
webmoney: E265281470651 Z422237915069 R418926282008
Hugo121 вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
application-defined or object-defined error Ошибка - 1004 Shubin Microsoft Office Excel 6 09.11.2011 17:37
runtime error 1004 application defined or object defined Ilgar Microsoft Office Excel 3 21.09.2011 17:20
Cells. Application-defined or object-defined error mau6 Microsoft Office Excel 5 26.08.2010 13:31
ошибка run-time 1004: application-defined or object-defined error Святой Дьявол Microsoft Office Excel 3 26.06.2010 11:06
Run-time error '1004': Application-defined or object-defined error malor Microsoft Office Excel 3 17.01.2010 17:13