Помогите пожалуйста разобраться. Все время возникает ошибка Runtime error '6' Overflow в VBA.
Ошибка возникает в этой строке "If WBook.Cells(q, 7) = ArrayPhoneAll(i) Then"
В столбце находятся телефонные номера или email, если поменять номер столбца, никакой ошибки не возникает.
Sub RegisterComplaintsPhone()
Dim n As Integer
Dim q As Long
n = 1
Set WBook = Workbooks("ДС_Реестр жалоб ГЛ и ЧАТ 09.07.2021222.xlsx").Worksheets("ДС_ГЛ, ЧАТ")
ReDim ArrayPhone(n) As Variant
ReDim ArraySuccess(n) As Variant
ReDim ArrayResult(n) As Variant
ReDim ArrayPhone(n) As Variant
ReDim ArrayFIO(n) As Variant
ReDim ArrayDS(n) As Variant
ReDim ArrayEmployee(n) As Variant
ReDim ArrayEmployeeAll(n) As Variant
ReDim ArrayDSAll(n) As Variant
ReDim ArrayPhoneAll(n) As Variant
ReDim ArrayResultAll(n) As Variant
n = 1
For w = 2 To 300
If Worksheets("ДС").Cells(w, 2) <> "" Then
ArrayPhoneAll(n) = Worksheets("ДС").Cells(w, 14).Value
ArrayEmployeeAll(n) = Worksheets("ДС").Cells(w, 3).Value
ArrayResultAll(n) = Worksheets("ДС").Cells(w, 2).Value
Worksheets("ДС").Cells(w, 19) = ArrayPhoneAll(n)
Worksheets("ДС").Cells(w, 20) = ArrayEmployeeAll(n)
Worksheets("ДС").Cells(w, 21) = ArrayResultAll(n)
n = n + 1
'ReDim Preserve ArrayDSAll(n)
ReDim Preserve ArrayPhoneAll(n)
ReDim Preserve ArrayEmployeeAll(n)
ReDim Preserve ArrayResultAll(n)
End If
Next
n = 1
MsgBox ArrayPhoneAll(1)
For i = 1 To UBound(ArrayPhoneAll) - 1
For q = 2 To 20000
If WBook.Cells(q, 7) = ArrayPhoneAll(i) Then
WBook.Cells(q, 31) = ArrayPhoneAll(i)
End If
Next
Next
End Sub