I'm trying to get this macro to loop a specified
number of times. I tried some examples in Excel help
but none worked. I have over 40,000 rows on the
spreadsheet. I want it to loop 25 or 50 or maybe 100
times starting on the ActiveCell.
This code works fine (1 row at a time)
Sub Check()
ActiveCell.Offset(1, 0).Activate
Selection.Copy
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System")
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
Set Field = System.ActiveSession.Screen.Area(3, 8, 3, 16)
Set Field1 = System.ActiveSession.Screen.Area(4, 75, 4, 78)
Set Field2 = System.ActiveSession.Screen.Area(4, 75, 4, 78)
Set Field3 = System.ActiveSession.Screen.Area(4, 75, 4, 78)
Set Field4 = System.ActiveSession.Screen.Area(4, 75, 4, 78)
Field.Select
Field.Delete
Field.Value = ActiveCell
SendKeys "%{TAB}"
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.MoveTo 3, 24
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("081")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Enter>")
Do While Sess0.Screen.OIA.Xstatus <> 0
DoEvents
Loop
ActiveCell.Offset(0, 1) = Field1.Value
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.MoveTo 3, 24
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("082")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Enter>")
Do While Sess0.Screen.OIA.Xstatus <> 0
DoEvents
Loop
ActiveCell.Offset(0, 2) = Field2.Value
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.MoveTo 3, 24
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("083")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Enter>")
Do While Sess0.Screen.OIA.Xstatus <> 0
DoEvents
Loop
ActiveCell.Offset(0, 3) = Field3.Value
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.MoveTo 3, 24
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("084")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Enter>")
Do While Sess0.Screen.OIA.Xstatus <> 0
DoEvents
Loop
ActiveCell.Offset(0, 4) = Field4.Value
End Sub
number of times. I tried some examples in Excel help
but none worked. I have over 40,000 rows on the
spreadsheet. I want it to loop 25 or 50 or maybe 100
times starting on the ActiveCell.
This code works fine (1 row at a time)
Sub Check()
ActiveCell.Offset(1, 0).Activate
Selection.Copy
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System")
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
Set Field = System.ActiveSession.Screen.Area(3, 8, 3, 16)
Set Field1 = System.ActiveSession.Screen.Area(4, 75, 4, 78)
Set Field2 = System.ActiveSession.Screen.Area(4, 75, 4, 78)
Set Field3 = System.ActiveSession.Screen.Area(4, 75, 4, 78)
Set Field4 = System.ActiveSession.Screen.Area(4, 75, 4, 78)
Field.Select
Field.Delete
Field.Value = ActiveCell
SendKeys "%{TAB}"
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.MoveTo 3, 24
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("081")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Enter>")
Do While Sess0.Screen.OIA.Xstatus <> 0
DoEvents
Loop
ActiveCell.Offset(0, 1) = Field1.Value
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.MoveTo 3, 24
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("082")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Enter>")
Do While Sess0.Screen.OIA.Xstatus <> 0
DoEvents
Loop
ActiveCell.Offset(0, 2) = Field2.Value
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.MoveTo 3, 24
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("083")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Enter>")
Do While Sess0.Screen.OIA.Xstatus <> 0
DoEvents
Loop
ActiveCell.Offset(0, 3) = Field3.Value
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.MoveTo 3, 24
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("084")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Enter>")
Do While Sess0.Screen.OIA.Xstatus <> 0
DoEvents
Loop
ActiveCell.Offset(0, 4) = Field4.Value
End Sub