M
MikeB
Two different problems in my continueing VBA journey.
I'm trying to find every 100th incidence of a counter.
I have
Option Compare Database
Option Explicit
Sub Main()
Dim i As Integer
For i = 1 To 120 Step 1
AmI100 (i)
Next i
End Sub
Sub AmI100(ByVal i As Integer)
Dim li As Long
Dim ii As Integer
li = CLng(i) / CLng(100)
Debug.Print "li: " & li
ii = i / 100
Debug.Print "ii: " & ii
If li = CLng(ii) Then
Debug.Print "Printing line " & i & " at " & Now()
End If
End Sub
It's still not working.
I *always* get that
li = CLng(i) / CLng(100) = 1
and
ii = i / 100 = 1
Also, if I type
li = CLng(i) / 100.00
in the IDE, it is automatically changed to:
li = CLng(i) / 100#
Why is that?
Thanks
I'm trying to find every 100th incidence of a counter.
I have
Option Compare Database
Option Explicit
Sub Main()
Dim i As Integer
For i = 1 To 120 Step 1
AmI100 (i)
Next i
End Sub
Sub AmI100(ByVal i As Integer)
Dim li As Long
Dim ii As Integer
li = CLng(i) / CLng(100)
Debug.Print "li: " & li
ii = i / 100
Debug.Print "ii: " & ii
If li = CLng(ii) Then
Debug.Print "Printing line " & i & " at " & Now()
End If
End Sub
It's still not working.
I *always* get that
li = CLng(i) / CLng(100) = 1
and
ii = i / 100 = 1
Also, if I type
li = CLng(i) / 100.00
in the IDE, it is automatically changed to:
li = CLng(i) / 100#
Why is that?
Thanks