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!

Data from Excel to Extra and back

Status
Not open for further replies.

tchad

Technical User
Jul 21, 2009
22
0
0
AU
Hi,

Just after help with a macro to pull a number from Excel, put it into Extra, pull the result from a field in Extra and then loop with the next cell down, until there are no more cells left in Excel with data in them.

My macro I had worked for one line, but I can't work out how to loop it from the first cell to the bottom cell.

If anyone has any macros that could point me in the right direction, that would be great.

Thanks.

 


Yes, you need something in the Do...Loop to Exit the loop, as both vzachin and I have suggested previously.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I don't want to exit the do though, as it will then repeat statements outside the do loop which I don't want repeated.

I just need to go down to the next row within the loop, that's all.
 
when you exit the loop, it will go to the next x. then it will go to the do/loop again until it exits...

did you at least try adding the exit do to see what will happen?

you need trust us

Code:
    with
    
        for
        
            do
            
                if
                
                
                else 
                
                exit do : end if
                
            
            loop
            
        next
    
    end with
 
I did, but the first lot of code below will run again if I abort the do. I need to keep looping but go to the next row. I did try it.

With Worksheets("Multiple Store")

For x = Rw To ActiveSheet.Rows.Count

Keycode = .Cells(x, 1)
Qty = .Cells(x, 2)
Store = .Cells(x, 3)
If Store = "" Then Exit Sub

'-----send data to Attachmate-------


'Front Screen

Sess0.Screen.PutString Store, 11, 30
Sess0.Screen.MoveTo 12, 30
Sess0.Screen.SendKeys (NOTBEFORE)
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.MoveTo 13, 30
Sess0.Screen.SendKeys (NOTAFTER)
Sess0.Screen.MoveTo 16, 30
Sess0.Screen.SendKeys ("D")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Enter>")

 
tchad,

there's something about your code that i don't quite understand.

is this what your code is supposed to be doing:
(1) find store
(2) if keycode is not blank, do something
(3) otherwise if keycode is blank, do something else
(4) then go to the next store and repeat

first lot of code below will run again if I abort the do
which code should not run again?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top