Thread: If Statement
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
zhj23 zhj23 is offline
external usenet poster
 
Posts: 60
Default If Statement

I have a following few lines of VBA codes. With input n=6, why is that when I
test dn it DOESN'T work, but test d(n+0) it works, which gives j=4.

Thanks.

n = InputBox("n")

j = 0

Do While j < n
j = j + 1

d = (n * j) / 3

If d (n + 0) Then Exit Do

MsgBox ("d= ") & d & (" n= ") & n 'monitoring

Loop

MsgBox ("j= ") & j 'output