View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Loop Not Working

What is in BitCount?

What do you expect to see?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Paul Black" wrote in message
ps.com...
Hi everyone,

Why does this not work please. It is suppose to produce a list several
lines long but only produces 1 line.

For cmb = 1 To P
tly = 0
For idx = 0 To (2 ^ P) - 1
If BitCount(idx / 5000) = cmb Then
tly = tly + 1
End If
Next
Range("b32").Select
With ActiveCell
.Offset(0, 0).Value = "W"
.Offset(1, 0).Value = "For " & P & " numbers " & Format(tly,
"#,##0") & _
" different " & cmb & " num. "
.Offset(2, 0).Select
End With
Next

Thanks in Advance.
All the Best.
Paul