juster21
Well-known Member
- Joined
- Jun 3, 2005
- Messages
- 867
I am using the following vba to read the last cell on a worksheet.
This works ok until the number reaches 10 at which point it never changes. The expected result is, starting at 0, read the cell value and add 1. Once the cell value reaches 10 however it ceases to add 1 and every row after shows a value of 10.
Thoughts?
Code:
If Not rsDoc.EOF Then
intLastUsedID = IIf(IsNumeric(rsDoc(0)), rsDoc(0), -1)
Else
intLastUsedID = 0
End If
This works ok until the number reaches 10 at which point it never changes. The expected result is, starting at 0, read the cell value and add 1. Once the cell value reaches 10 however it ceases to add 1 and every row after shows a value of 10.
Thoughts?