Results 1 to 2 of 2

Thread: Loop problem

  1. #1

    Thread Starter
    Lively Member rocket0612's Avatar
    Join Date
    Feb 2005
    Location
    Belfast, Northern Ireland
    Posts
    95

    Loop problem

    I am writing a macro for excel to interact with Attachmate and have problems ith a lopp I'm try to do. Heres the code:

    Code:
    Date1 = Range("C20"): Date1 = Format(Date1, "ddmmyy")
        Date2 = Range("c22"): Date2 = Format(Date2, "ddmmyy")
                  
        If Range("C20") <> "" Then Quote1 = True
        If Range("C22") <> "" Then Quote2 = True
        
        If Quote1 = True Then Quotetype1 = Date1 Else Quotetype1 = ""
        If Quote2 = True Then Quotetype2 = Date2 Else Quotetype2 = ""
        
                
            QuoteArray = Array(Quotetype1, Quotetype2)
            quoteletterArray = Array(Quotetype1, Quotetype2)
            npddarray = Array("", "")
            QualArray = Array(qual1, qual2)
            
        '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                'ScrnChk = MyScreen.GetString(2, 3, 7)
                'If ScrnChk <> "BRPEIMA" Then End: MsgBox ("ended at proj")
                
           'two dates, do 1st date and then loop for second adte
        For quoteroutine = 0 To 1
        If QuoteArray(quoteroutine) = "" Then GoTo Notes
        
        'run for date 1 for the 3 policiy numbers
                For polroutine = 0 To 2
                PolNo = polarray(polroutine)
                If PolNo = "" Then GoTo Quotevaluesflf
               
                    Sess0.Screen.Moveto 21, 68
                    Sess0.Screen.SendKeys ("PIB")
                    Sess0.Screen.SendKeys ("<Enter>")
                    Sess0.Screen.WaitHostQuiet (g_hostsettletime)
    The scenario is, a user can input up to 3 policy numbers for the system perform valuations. You have the option to have 2 valuation dates (date 1 & date 2). What I am trying to do is get the 3 policies to run a valuation for the first date and then go back and do the same for the second date.

    I am getting the error on the second FOR statement advbising the statement is already in use. I am trying to do like a double loop to do this, make sense!!

    any help would be appreciated.
    The Box Said: "You need Windows Vista or better" ... So I Installed LiNUX

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Loop problem

    You have 2 FOR statements in the code you posted, but no NEXT statements at all. Can you repost and include the entire procedure?
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

Posting Permissions

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



Click Here to Expand Forum to Full Width