ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Handling Null Field in Macro Loop (https://www.excelbanter.com/excel-programming/314067-handling-null-field-macro-loop.html)

Ken

Handling Null Field in Macro Loop
 
The following loop is part of a larger macro.

For ILoop = NumRowsF850 To 1 Step -1
If Cells(ILoop, 5) = 0 Then
Rows(ILoop).Delete
End If
Next ILoop

If I find a null cell in the loop on line two, it is evaluated as 0 and the
code branches to the third line.

I do not want to execute the third line of code if the cell is null.

How do I need to re-code line two to avoid this problem?

TIA.

Jake Marx[_3_]

Handling Null Field in Macro Loop
 
Ken wrote:
How do I need to re-code line two to avoid this problem?


Please see response to thread started 10 mins earlier.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

Ken

Handling Null Field in Macro Loop
 
Sorry about the multiple posts. The website kept telling me the message
wasn't sent.

"Ken" wrote:

The following loop is part of a larger macro.

For ILoop = NumRowsF850 To 1 Step -1
If Cells(ILoop, 5) = 0 Then
Rows(ILoop).Delete
End If
Next ILoop

If I find a null cell in the loop on line two, it is evaluated as 0 and the
code branches to the third line.

I do not want to execute the third line of code if the cell is null.

How do I need to re-code line two to avoid this problem?

TIA.



All times are GMT +1. The time now is 01:31 PM.

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