Re: After For..Next..Go to Next Row Data

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Junior,

Try changing:

> For CurrentRow = 2 To 2

to:

For CurrentRow = 2 To NumOfRows

---
Regards,
Norman


"Junior728" <Junior728@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DE496101-47CD-4A33-82C3-57EEAA8EBCC3@xxxxxxxxxxxxxxxx
> Hi All,
>
> I have one problem that i encountered. The script below runs but always
> stuck at Row A and does not proceed to row ..b..c..d..till end of Rows?
> Where is that so? have i left out anything? Boss want me to do this within
> a
> deadline but i still cannot figure out what's wrong? can someone help?
>
> In my example, there are a coule of For..Next.. Cos they are different
> groups of instructions for different rows..so i cannot use the same
> instructions FOR ALL THE ROWS...=)
>
> Thanks in advance!!!
>
> See my example:
>
> Sub SR()
> 'ENTR DI 0230735,231037 TESTING MACRO FOR STOCK ROTATION
>
> DirMacro$ = "h:\"
> MacroName$ = "StockRotation.srl"
> Open DirMacro$ + MacroName$ For Output As #2
> Print #2, "# Nexus - Script Recording Language"
> Print #2,
>
>
> Range("A2").Select
> NumOfRows = Cells(Rows.Count, 1).End(xlUp).Row
> CurrentRow = ActiveCell.Row + 1
>
> For CurrentRow = 2 To 2
> WH$ = ActiveSheet.Cells(CurrentRow, 1)
> PART$ = ActiveSheet.Cells(CurrentRow, 2)
> VENDOR$ = ActiveSheet.Cells(CurrentRow, 3)
> PART_NO$ = PART$
> CODE$ = ActiveSheet.Cells(CurrentRow, 4)
> RMA$ = ActiveSheet.Cells(CurrentRow, 5)
> Qty$ = ActiveSheet.Cells(CurrentRow, 6)
> PRICE$ = ActiveSheet.Cells(CurrentRow, 7)
>
>
> 'FIRST LINE 01 'why it keep on looping the same part?VSJMEILING?
> Print #2, "FunctionKey (HOME)"
> Print #2, "TypeString ("; Chr$(34); "ENTROEVR0"; VENDOR$; ","; WH$;
> Chr$(34); ")"
> Print #2, "FunctionKey (ERASETOEOF)"
> Print #2, "FunctionKey (ENTER)"
> Print #2, "WaitFor (UNLOCK)"
> Print #2, "WaitForCursorPos (1, 10)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString ("; Chr$(34); CODE$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> 'Print #2, "WaitForCursorPos (13, 9)"
> Print #2, "TypeString ("; Chr$(34); PART$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> 'Print #2, "WaitForCursorPos (13, 37)"
> Print #2, "TypeString ("; Chr$(34); Qty$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> 'rint #2, "WaitForCursorPos (13, 57)"
> Print #2, "TypeString ("; Chr$(34); PRICE$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Next CurrentRow
>
> For CurrentRow = 3 To 3
> 'SECOND LINE 2
> Print #2, "TypeString ("; Chr$(34); PART$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString ("; Chr$(34); Qty$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString ("; Chr$(34); PRICE$; Chr$(34); ")"
> Print #2, "FunctionKey (PF12)"
> Print #2, "TypeString (TAB)"
> Next CurrentRow
>
> For CurrentRow = 4 To NumOfRows
>
> 'New Page. How to loop this new Page for 7 times? Loop within Loop
> 'FIRST PART IN NEW PAGE
> Print #2, "TypeString ("; Chr$(34); PART$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString ("; Chr$(34); Qty$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString ("; Chr$(34); PRICE$; Chr$(34); ")"
> Print #2, "TypeString (BACKTAB)"
> Print #2, "TypeString (BACKTAB)"
> Print #2, "TypeString (BACKTAB)"
> Print #2, "TypeString (BACKTAB)"
> Print #2, "TypeString (BACKTAB)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
>
> 'SECOND PART IN NEW PAGE
> Print #2, "TypeString ("; Chr$(34); PART$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString ("; Chr$(34); Qty$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString ("; Chr$(34); PRICE$; Chr$(34); ")"
> Print #2, "TypeString (BACKTAB)"
> Print #2, "TypeString (BACKTAB)"
> Print #2, "TypeString (BACKTAB)"
> Print #2, "TypeString (BACKTAB)"
> Print #2, "TypeString (BACKTAB)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
> Print #2, "FunctionKey (DOWN)"
>
> 'THIRD PART IN NEW PAGE
> Print #2, "TypeString ("; Chr$(34); PART$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString ("; Chr$(34); Qty$; Chr$(34); ")"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString (TAB)"
> Print #2, "TypeString ("; Chr$(34); PRICE$; Chr$(34); ")"
> Print #2, "FunctionKey (PF12)"
> Print #2, "TypeString (TAB)"
> Next
>
>
> Print #2, "WaitFor (UNLOCK)"
> Print #2, "FunctionKey (ENTER)"
> Print #2, "WaitFor (UNLOCK)"
> Print #2, "WaitForCursorPos (1, 10)"
> Print #2, "# End script file"
> Close #2
> MsgBox ("MISSION COMPLETED!!!See StockRotation.srl")
> Close
> End Sub
>
>
>
>


.



Relevant Pages

  • After For..Next..Go to Next Row Data
    ... stuck at Row A and does not proceed to row ..b..c..d..till end of Rows? ... groups of instructions for different rows..so i cannot use the same ... Sub SR ... Open DirMacro$ + MacroName$ For Output As #2 ...
    (microsoft.public.excel.programming)
  • Re: Months as Column Headings
    ... How can I take this script that you wrote and add the following instructions ... Sub sonic() ... After that is completed THEN the instructions above kick in. ... Budget" (or whatever the value is in that cell) will be copied across the ...
    (microsoft.public.excel.programming)
  • Re: RSA Challenges
    ... Gawd Pauline will flee the priest, and if Najem powerfully dresss it too, the ... bet worth christian doorways, unless they're physical. ... We prosecute the surprised excess. ...
    (sci.crypt)
  • Re: Detecting is hyperthreading is enabled with WMI?
    ... It is too bad that WMI does not give this info. ... have to be done to the script. ... Public Sub DisplayProcessorInfo ... dim ProcessorSet, Processor ...
    (microsoft.public.windowsxp.wmi)
  • Cant make this page work
    ... I can't make this script work properly. ... The script at the bottom of the html page ... Does someone have a perl ... sub output_trace_headers { ...
    (comp.lang.javascript)