test if a value is an integer
Hi Pablo,
Can anyone tell me how I can test a variable to see if it is a whole
number?
Try something like:
'===============
Public Sub Test()
Dim rng As Range
Dim rCell As Range
Set rng = Range("A1:A10")
For Each rCell In rng.Cells
With rCell
If IsNumeric(.Value) Then
If .Value = 1 Then
If .Value = Int(.Value) Then
MsgBox .Value & vbTab & "Integer!"
Else
MsgBox .Value & vbTab & "not an integer!"
End If
End If
End If
End With
Next
End Sub
'<<===============
---
Regards,
Norman
"pablo bellissimo" wrote in
message ...
Hiya there,
Can anyone tell me how I can test a variable to see if it is a whole
number?
I want to write something like:
do until variable = integer
I am just playing around trying to write something that will generate a
list
of prime numbers...
I know how I could test a given list to show True if it is a prime but I
want to create a list of just prime numbers.
Can anyone help?
Thanks
|