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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I count

Status
Not open for further replies.

vzachin

Technical User
Feb 10, 2006
305
US
hi,

Is it possible to count the number of "C"s that were placed?
The following code I have places a "C" in column 2 if there is a minus sign (-) in column 20 of the same row & and also delete the minus sign, beginning with row 14 through 23. After it reaches row 23, it performs an update (PF5) regardless if there were any minus signs found.(i didn't know how to bypass this, but that's not important).
After the update, it would page forward and continue until there are no entries in column 8.
I want to count the number of "C"s and place this number into Excel.I know how to place data into Excel.

Code:
Do
For X = 14 To 23
Minus = NY.Screen.GetString(X, 20, 1)
Pos = NY.Screen.GetString(X, 8, 6)
If Pos = "      " Then
NY.Screen.SendKeys ("<PF5>")	'<--Update
Exit Sub
End If

If Minus = "-" Then
NY.Screen.MoveTo X, 20
NY.Screen.SendKeys ("<Delete>")
NY.Screen.PutString "C", X, 2

End If

Next
NY.Screen.SendKeys ("<PF5>")	'<--Update
NY.Screen.WaitHostQuiet (1000)
NY.Screen.SendKeys ("<PF2>")	'<--Page forward
NY.Screen.WaitHostQuiet (1000)
Loop
End If
End Sub
[code]


thanks for your thoughts
zach
 
Code:
If Minus = "-" Then
  NY.Screen.MoveTo X, 20
  NY.Screen.SendKeys ("<Delete>")
  NY.Screen.PutString "C", X, 2
  [COLOR=blue]Ccount = Ccount + 1 [/color]
End If
...
...
...
End If[COLOR=blue]
msgbox Ccount  'write to excell here[/color]
End Sub


[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
thanks MrMilson,

that's exactly what i needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top