How to make a loop for specific problem

Discussion in 'AutoCAD' started by KCGalloway, Jul 14, 2004.

  1. KCGalloway

    KCGalloway Guest

    I currently have a program that takes values from excel and puts them in an array. Now, I want to build in some default commands. For instance, if the user enters text into a cell that is suppose to be a real number, the program would enter a default value into the cell such as zero.

    The syntax isn't correct, but here is the loop that I was thinking.
    (note: I do know the size of the array. It is 5)

    Dim ParamArray Arg() As Variant
    Dim i As Integer

    Loop Until i < 6

    If Arg(i) (is not equal. what is the symbol for this?) /= Double Then

    Arg(i) = 0

    End If

    End Loop


    Any ideas. Thanks.

    Best,

    Kevin
     
    KCGalloway, Jul 14, 2004
    #1
  2. KCGalloway

    Conan Witzel Guest

    Try IsNumeric()

    Conan Witzel
     
    Conan Witzel, Jul 14, 2004
    #2
  3. KCGalloway

    Dragnsbld Guest

    why don't you test to see if it's a real number ie. No decimal, not negative.

    if instr(1, arg(i), ".") <>0 then
    xxxxxxxxxxx
    elseif instr(1,arg(i),"-")<>0 then
    xxxxxxxxxxx
    end if
     
    Dragnsbld, Jul 15, 2004
    #3
  4. KCGalloway

    KCGalloway Guest

    Thank you. Both ideas really helped.

    Best,

    Kevin
     
    KCGalloway, Jul 15, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.