Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to return to FOR (one LOOP)

Status
Not open for further replies.

amecari

Technical User
Mar 21, 2001
29
0
0
BR
I have two worksheets : Names and Results. The wsheet Name contain in A1 to A27 names tha I`ll work. The wsheet Results
contain informations about the names Adress, Age, etc.. Don`t problem.

Hi, this is the problem. I`m write something like this:



Sub Start()
Dim sName(27) as String
Dim cod_name as String
For N = 1 to 27
sName(m)= Worksheets("Names").Range("A" & N).value
Next

For Q = 1 to 27
cod_sname = sname(Q)

Enviar(cod_sname, 0, 1, 17,23)
Captura.Tela
Converte.Tela
adress = Extra.dados
cells(2, 3).value
Next y
End Sub

*****
I`m going to send the Variable sName to another program(Extra Personal Client) , that when the program to receive this "input", the name, and find it send me informations about this name like age, adress, etc, that will go to write in antoher Plan : Results. This I kown how to do.
But if this name doesn`t exist is necessary to continue with the next name in the plan Names. Or better, I need to send next name, the program then capture this name if it exist send to Plan Result if don`t next name.
But I`ll only known if the name exist or not if I send the name first.
 
Hello. I'm not sure I understand all the details, but it ssems like you need an IF Then command to handle the two different situations - 1) name does exist 2) name does NOT exist. Just after you capture the name in your variable sName put in an IF to check to see if that name exists on the target sheet if it does NOT after the Then route the name where you want it to go. The Else command is next and the code to route the name if it is in the file. End if completes the command. Next y follows the End If The loop should run through the names sending each to the appropriate sheet.

IF (look for the sName on the sheet)=not found Then
put the code here
Else 'the name was found on the list
put the code here
End If 'this completes the testing process
Next y

 
Hi,
This should be a function (perhaps a boolean function) that returns a value. Based on that value (found or not) you will dow your process as MRussell has suggested.
Code:
MyResult = Enviar(cod_sname, 0, 1, 17,23)

If MyResult Then
'This is where you process thr found result

Else
'This is where you do any exception processing

End If
Hope this helps :) Skip,
metzgsk@voughtaircraft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top