ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run-time error 1004 since upgrading from Excel 2003 to 2007. (https://www.excelbanter.com/excel-programming/414502-run-time-error-1004-since-upgrading-excel-2003-2007-a.html)

PJ

Run-time error 1004 since upgrading from Excel 2003 to 2007.
 
I have a workbook with many, many macros. Since I upgraded to Excel 2007, I
am receiving the following error message with one of my macros:

"Run-time error 1004. The number must be between 1 and 32767. Try again by
entering a number in this range"

Here is a sample of the code. The statement "Application.MaxIterations =
olditer" is the line that is being highliged by Visual Basic.

skipcalc4:
If Worksheets("Workarea").Cells(43, 7) < 0 Then
Worksheets("NPV Model Workarea").Cells(43, 7) = 0
End If

Application.MaxIterations = olditer
Application.MaxChange = oldchange

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Worksheets("Workarea").Visible = False

End Sub

Jim Rech[_2_]

Run-time error 1004 since upgrading from Excel 2003 to 2007.
 
At the risk of stating the obvious, there's something wrong with "olditer".
Since you didn't provide the code that sets it is there any chance it's not
being set? And therefore has the value 0 (which is not between 1 and
32767)?

--
Jim
"PJ" wrote in message
...
I have a workbook with many, many macros. Since I upgraded to Excel 2007,
I
am receiving the following error message with one of my macros:

"Run-time error 1004. The number must be between 1 and 32767. Try again
by
entering a number in this range"

Here is a sample of the code. The statement "Application.MaxIterations =
olditer" is the line that is being highliged by Visual Basic.

skipcalc4:
If Worksheets("Workarea").Cells(43, 7) < 0 Then
Worksheets("NPV Model Workarea").Cells(43, 7) = 0
End If

Application.MaxIterations = olditer
Application.MaxChange = oldchange

ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
Worksheets("Workarea").Visible = False

End Sub





All times are GMT +1. The time now is 06:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com