I got an error message that says "Run-time error '6': Overflow".
The following line was highlighted.
I checked several variables type and value. cell.address was "$E$22", cell.value was 1500, and totalVoucherAmt was 31500. totalVoucherAmt was interget but cell.Value was Variant/Double. I checked several cells in column E and they all were of the type Variant/Double.
Could this discrepancy be the source of the error? If it is, how come the problem did not show up earlier, between E6 and E21?
How do I solve the problem? Thanks.
======================================
Set rng1 = Range("E6", [E330].End(xlUp))
rng1.NumberFormat = "0"
For Each cell In rng1
totalVoucherAmt = totalVoucherAmt + cell.Value <- highlighted
Next
The following line was highlighted.
I checked several variables type and value. cell.address was "$E$22", cell.value was 1500, and totalVoucherAmt was 31500. totalVoucherAmt was interget but cell.Value was Variant/Double. I checked several cells in column E and they all were of the type Variant/Double.
Could this discrepancy be the source of the error? If it is, how come the problem did not show up earlier, between E6 and E21?
How do I solve the problem? Thanks.
======================================
Set rng1 = Range("E6", [E330].End(xlUp))
rng1.NumberFormat = "0"
For Each cell In rng1
totalVoucherAmt = totalVoucherAmt + cell.Value <- highlighted
Next