VBA Capacity Overflow
Solved
Ecam39
Posted messages
314
Status
Member
-
Ecam39 Posted messages 314 Status Member -
Ecam39 Posted messages 314 Status Member -
Hello,
I wrote a variable in DIM As Long with a loop until the end of the column.
However, when I run the procedure, I receive a "Runtime Error '6' Overflow" message.
I don't know what this message corresponds to, I changed the variable but still the same message.
Here is the beginning of the procedure:
How can I remedy this?
Thank you
Configuration: Windows 7 / Internet Explorer 10.0
I wrote a variable in DIM As Long with a loop until the end of the column.
However, when I run the procedure, I receive a "Runtime Error '6' Overflow" message.
I don't know what this message corresponds to, I changed the variable but still the same message.
Here is the beginning of the procedure:
Sub stock_reception()
'Initializing the variable ecart_de_stock
Dim ecart_de_stock As Long
ecart_de_stock = 2
'Start the loop in column E
For ecart_de_stock = 2 To Range("E2").End(xlDown).Row
'In the loop, perform the calculation based on the condition
If Not IsEmpty(Cells(ecart_de_stock, 5)) Then
'Define today's date for the new inventory
If Not IsEmpty(Cells(ecart_de_stock, 3)) And Cells(ecart_de_stock, 1) = "" Then
Cells(ecart_de_stock, 1) = Date
Else
End If
'Define the month based on the input date
Cells(ecart_de_stock, 2) = Month(Cells(ecart_de_stock, 1))
'Display 0 or 1 based on the location discrepancy
If Cells(ecart_de_stock, 4) - Cells(ecart_de_stock, 5) = 0 Then
Cells(ecart_de_stock, 6) = 1
Else
Cells(ecart_de_stock, 6) = 0
End If
'Display the discrepancy of rolls between physical and computer stock, without sign
Cells(ecart_de_stock, 7) = Abs(Cells(ecart_de_stock, 4) - Cells(ecart_de_stock, 5))
'Perform the calculation in % of the rolls discrepancy
Cells(ecart_de_stock, 8) = Abs(1 - (Cells(ecart_de_stock, 7) / Cells(ecart_de_stock, 4)))
Else
End If
Next
ActiveWorkbook.RefreshAll
End Sub
How can I remedy this?
Thank you
Configuration: Windows 7 / Internet Explorer 10.0