L
Legacy 313594
Guest
All,
I need help using the loop function to move to the next row while always following the Column order of "I, A, B, D, C, E, F, G, H" Currently, I have alot of identical code, only difference is the row number is increasing. There must be a way to utilize 1 section of code and have it run from row 1 to end of data while following the above Column Copy order.
Here is my code.
I heard using Activecell.offset(1,0).Select, is an option?</ctrl+m></ctrl+[></ctrl+[></ctrl+m></ctrl+[></ctrl+[></ctrl+m></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></keypad></keypad></tab></tab></tab></ctrl+m></ctrl+[></ctrl+m></tab></tab></ctrl+m></ctrl+m></ctrl+[></ctrl+m></ctrl+m>
I need help using the loop function to move to the next row while always following the Column order of "I, A, B, D, C, E, F, G, H" Currently, I have alot of identical code, only difference is the row number is increasing. There must be a way to utilize 1 section of code and have it run from row 1 to end of data while following the above Column Copy order.
Here is my code.
Code:
Dim sh As WorksheetSet sh = ThisWorkbook.Sheets("Muni Loading")
Dim k As Long
Dim G As Long
If IsEmpty(sh.Range("A1").End(xlDown)) = True Then
k = 1 'Determines # of rows of Data w/Header in Worksheet
Else
k = sh.Range("A1", sh.Range("A1").End(xlDown)).Rows.Count
G = k - 1 'G Determines # of rows of Data minus header
End If
'Begin Loading Municipal Bond Securities
Sess0.Screen.SendKeys ("<ctrl+m>") 'Select Enter Button to bring cursur to APL Function Line
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("EDITSEC <ctrl+m>") 'Enter Pneumonic
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sheets("Muni Loading").Activate 'Activate Loading Sheet
Range("I2").Copy 'Copy Security from Excel
Sess0.Screen.Paste 'Paste Security into EDITSEC Field
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<ctrl+[>[B<ctrl+m>") 'Arrow down & Enter Yes to Add Security
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<ctrl+m>") 'Arrow down & Enter Yes to Add Security
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<tab><tab><ctrl+m>") 'Arrow Down & Select Muni Option
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<ctrl+[>[B<ctrl+m>") 'Arrow Down & Select "Yes" I want to add this security now
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sheets("Muni Loading").Activate 'Initiate Loading Sheet
Range("A2").Copy 'Copy Security Name from Excel
Sess0.Screen.Paste 'Paste Security Name into APL
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<tab><tab><tab>") 'Tab 3 times to ISSTY Field
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<keypad 5=""><keypad 0="">") 'Enter "50" for Muni
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<tab><tab>") 'Tab 2x's to get to DTD Field
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sheets("Muni Loading").Activate 'Initiate Loading Sheet
Range("B2").Copy 'Copy Dated Date from Excel
Sess0.Screen.Paste 'Paste Security Name into APL
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<tab><tab>") 'Tab 2x's to get to CLSEP Field
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sheets("Muni Loading").Activate 'Initiate Loading Sheet
Range("D2").Copy 'Copy PX_Last(Closing Price)from Excel
Sess0.Screen.Paste 'Paste Closing Price into APL
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<tab><tab>") 'Tab 2x's to get to MATDT Field
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sheets("Muni Loading").Activate 'Initiate Loading Sheet
Range("C2").Copy 'Copy Maturity Date from Excel
Sess0.Screen.Paste 'Paste Maturity Date into APL
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<tab><tab><tab><tab><tab><tab><tab>") 'Tab 7x's to get to MRATING Field
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sheets("Muni Loading").Activate 'Initiate Loading Sheet
Range("E2").Copy 'Copy RTG_MOODY (Moody's Rating) from Excel
Sess0.Screen.Paste 'Paste Moody's Rating into APL
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<tab>") 'Tab 1 time to get to SNPRAT Field
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sheets("Muni Loading").Activate 'Initiate Loading Sheet
Range("F2").Copy 'Copy RTG_SP (Standard & Poors Rating) from Excel
Sess0.Screen.Paste 'Paste Standard & Poors Rating into APL
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<tab>") 'Tab 1 time to get to CPNRT Field
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sheets("Muni Loading").Activate 'Initiate Loading Sheet
Range("G2").Copy 'Copy CPN (Coupon Rate) from Excel
Sess0.Screen.Paste 'Paste Coupon Rate into APL
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<tab><tab>") 'Tab 2x's to get to MSTATE Field
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sheets("Muni Loading").Activate 'Initiate Loading Sheet
Range("H2").Copy 'Copy STATE_CODE (State of issued Security) from Excel
Sess0.Screen.Paste 'Paste State Code into APL
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<ctrl+m>") 'Enter to solidify entry
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<ctrl+[>[010q<ctrl+[>[B<ctrl+m>") 'Hit F10, Select Yes Option to save
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
Sess0.Screen.SendKeys ("<ctrl+[>[003q<ctrl+[>[B<ctrl+m>") 'Hit Escape, Select Yes to add another Security
Sess0.Screen.WaitHostQuiet (g_HostSettleTime) 'Wait
I heard using Activecell.offset(1,0).Select, is an option?</ctrl+m></ctrl+[></ctrl+[></ctrl+m></ctrl+[></ctrl+[></ctrl+m></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></tab></keypad></keypad></tab></tab></tab></ctrl+m></ctrl+[></ctrl+m></tab></tab></ctrl+m></ctrl+m></ctrl+[></ctrl+m></ctrl+m>