ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA code erroring in XL97... (https://www.excelbanter.com/excel-programming/353414-vba-code-erroring-xl97.html)

sharpie23

VBA code erroring in XL97...
 
I wrote some VBA code in XL 2003. when the form was emailed to a 3rd
party using XL97 it errored. I understand that XL97 uses VBA 5.0 and
that it will not recognize functions that were added in VBA 6.0.

Here is the code section that is erroring

For Each i In Range("A71:A74, A77:A80, A83:A86, A89:A92, A95:A98,
A101:A104")
For Each n In Range(Cells(i.Row, 2), Cells(i.Row, 7))
If n.Value = "0" Then
Application.EnableEvents = False
Range(Cells(i.Row, 2), Cells(i.Row, 7)).Interior.ColorIndex
= xlColorIndexNone
Cells(i.Row, 11).ClearContents
Application.EnableEvents = True
GoTo NXTROW

It errors on the line.........If n.Value ="0"

Any Ideas?

Thanks
Ryan


Dave Peterson

VBA code erroring in XL97...
 
Do you know what's in that cell?

If it's an error (like #n/a), you'll have a problem.

maybe:

if iserror(n) then
'do error processing
else
if n.value = "0" then


or maybe
if n.value = 0 then

would be better????

sharpie23 wrote:

I wrote some VBA code in XL 2003. when the form was emailed to a 3rd
party using XL97 it errored. I understand that XL97 uses VBA 5.0 and
that it will not recognize functions that were added in VBA 6.0.

Here is the code section that is erroring

For Each i In Range("A71:A74, A77:A80, A83:A86, A89:A92, A95:A98,
A101:A104")
For Each n In Range(Cells(i.Row, 2), Cells(i.Row, 7))
If n.Value = "0" Then
Application.EnableEvents = False
Range(Cells(i.Row, 2), Cells(i.Row, 7)).Interior.ColorIndex
= xlColorIndexNone
Cells(i.Row, 11).ClearContents
Application.EnableEvents = True
GoTo NXTROW

It errors on the line.........If n.Value ="0"

Any Ideas?

Thanks
Ryan


--

Dave Peterson


All times are GMT +1. The time now is 02:26 PM.

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