+ Reply to Thread
Results 1 to 5 of 5

nested while not working any more...

  1. #1
    Registered User
    Join Date
    08-22-2006
    Posts
    4

    nested while not working any more...

    This works in Excel 2002, but fails at the second "while" in Excel 2003....


    Range("n50").Select
    target = -3
    j = 12
    K = 36
    Cells(j, 1).Select
    Reading = ActiveCell
    Cells(j, 4).Select
    ActiveCell.FormulaR1C1 = Reading
    Cells(j, 1).Select
    While ((target <= -2.5) And (j < 500))

    While (((Reading - target) <> 0) And (Not (Reading = "")))
    j = j + 1
    Cells(j, 1).Select
    Reading = ActiveCell
    Cells(j, 3).Select
    ActiveCell.FormulaR1C1 = Reading
    Cells(j, 2).Select
    CLD = ActiveCell
    Cells(j, 1).Select

    Wend
    Cells(K, 18).Select
    ActiveCell.FormulaR1C1 = CLD
    K = K + 1
    target = target + 1
    j = 12
    Wend


    ________________________________________________
    TIA,
    Crim

  2. #2
    Tim Williams
    Guest

    Re: nested while not working any more...

    Error message?

    --
    Tim Williams
    Palo Alto, CA


    "criminalspeed" <[email protected]> wrote in message
    news:[email protected]...
    >
    > This works in Excel 2002, but fails at the second "while" in Excel
    > 2003....
    >
    >
    > Range("n50").Select
    > target = -3
    > j = 12
    > K = 36
    > Cells(j, 1).Select
    > Reading = ActiveCell
    > Cells(j, 4).Select
    > ActiveCell.FormulaR1C1 = Reading
    > Cells(j, 1).Select
    > While ((target <= -2.5) And (j < 500))
    >
    > While (((Reading - target) <> 0) And (Not (Reading = "")))
    > j = j + 1
    > Cells(j, 1).Select
    > Reading = ActiveCell
    > Cells(j, 3).Select
    > ActiveCell.FormulaR1C1 = Reading
    > Cells(j, 2).Select
    > CLD = ActiveCell
    > Cells(j, 1).Select
    >
    > Wend
    > Cells(K, 18).Select
    > ActiveCell.FormulaR1C1 = CLD
    > K = K + 1
    > target = target + 1
    > j = 12
    > Wend
    >
    >
    > ________________________________________________
    > TIA,
    > Crim
    >
    >
    > --
    > criminalspeed
    > ------------------------------------------------------------------------
    > criminalspeed's Profile: http://www.excelforum.com/member.php...o&userid=37909
    > View this thread: http://www.excelforum.com/showthread...hreadid=574383
    >




  3. #3
    Registered User
    Join Date
    08-22-2006
    Posts
    4
    Run-time error '13':

    Type mismatch

  4. #4
    Registered User
    Join Date
    08-22-2006
    Posts
    4
    Thanks for the hint, getting closer.

    Not a programmer, prolly will be...

  5. #5
    Registered User
    Join Date
    08-22-2006
    Posts
    4
    Got it.

    Wasn't Excel, extra line in text file was throwing off the sequence.

    I studied the error message (as you pointed out) and cross referenced what it was reporting.

    Thanks again,
    I'm sure I'll be back.

    -Crim

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1