ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Evaluate an odd number of data lines (https://www.excelbanter.com/excel-programming/377432-evaluate-odd-number-data-lines.html)

xadnora

Evaluate an odd number of data lines
 
This is going to sound really lame but I'm having trouble with the coding of
an even or odd number check. I have a simple routine that loops through data
starting at "A1" and stops when the data breaks and counts the number of
lines there were. I need a statement to tell me if that number was odd and
then exit the sub. This should be easy to with any coding knowledge. Thanks.

Gary Keramidas

Evaluate an odd number of data lines
 
you could use a counter and then when you're done, use the mod function

If counter Mod 2 = 1 Then
MsgBox "it's odd"
Else
MsgBox "it's even"
End If


--


Gary


"xadnora" wrote in message
...
This is going to sound really lame but I'm having trouble with the coding of
an even or odd number check. I have a simple routine that loops through data
starting at "A1" and stops when the data breaks and counts the number of
lines there were. I need a statement to tell me if that number was odd and
then exit the sub. This should be easy to with any coding knowledge. Thanks.





All times are GMT +1. The time now is 12:32 AM.

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