Help :s

Moemennada

New Member
Joined
Mar 7, 2013
Messages
3
I am facing kind of a unique problem
i made a work book that is supposed to calculate packaging requirements for a production plant
the macros on it was working fine until one day it started to stop working over an " over flow Error " due to failure in referencing cells with the required values

for example : i have this condition
' here is supposed to be the if condition to calculate the Requirements for the Packaging
Code:
If Worksheets("Order Form").Cells(Row1, 6) = "Cartons" Then
    Cans = Worksheets("Order Form").Cells(Row1, 5) * Worksheets("Packaging Materials").Cells(Row2, 4)
    Else: Cans = Worksheets("Order Form").Cells(Row1, 5)
    End If

sometimes i find the VBA recognizing the value of variable "cans" as "zero" and sometimes i find it as the required value
without any significant change on my part
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
How did you Dim Cans? It should probably be a Long.

i dim them as integers but is an integer
because there is no fractions in 'cans'
only whole numbers because 'cans' is not divided by anything

also i would like to highlight that it was working fine before and for a year
it started prompting errors all of a sudden and with no apparent reason
and also the run time error debugging is always in a different place in the code
and always linked to worksheet r1c1 referencing code lines
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top