Hello everyone, I've lurked this forum for a few pieces of help here and there but just joined when I became really stumped. I'm trying to get my macro to pull information from my spreadsheet (each row one "location" address) and paste it into the program I'm working with. I used it to enter one at a time but now I'd like to have it do many as my volume as increased. What I have so far just enters the same row into the program repeatily - when I need to to enter once, then just down a row when done to enter the next.
Sorry, I'm a bit new to all of this but I'm slowly getting the hang of certain things little by little.
Here's my code I'm working on currently - thanks in advance to any pointers or tips, you have all already been very helpful on a couple other macro's I've done.
Sub Main()
Set Session = GetObject(, "xxx")
Application.ScreenUpdating = True
Dim lineX As Integer
With Session
Do Until ActiveCell.Value = ""
.TransmitANSI "1"
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMEnterKey
Range("A2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("B2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("C2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("D2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("E2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("F2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("G2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("H2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("I2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("J2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("K2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitANSI "Y"
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMEnterKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.SetMousePos 14, 72
.TerminalMouse rcLeftClick, rcMouseRow, rcMouseCol
Range("M2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMEnterKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
ActiveCell.Offset(1, 0).Select
.TransmitTerminalKey rcIBMF12Key
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMF12Key
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Loop
End With
Application.ScreenUpdating = True
Set Session = Nothing
End Sub
Sorry, I'm a bit new to all of this but I'm slowly getting the hang of certain things little by little.
Here's my code I'm working on currently - thanks in advance to any pointers or tips, you have all already been very helpful on a couple other macro's I've done.
Sub Main()
Set Session = GetObject(, "xxx")
Application.ScreenUpdating = True
Dim lineX As Integer
With Session
Do Until ActiveCell.Value = ""
.TransmitANSI "1"
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMEnterKey
Range("A2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("B2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("C2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("D2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("E2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("F2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("G2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("H2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("I2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("J2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Range("K2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMTabKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitANSI "Y"
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMEnterKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.SetMousePos 14, 72
.TerminalMouse rcLeftClick, rcMouseRow, rcMouseCol
Range("M2").Select
.TransmitANSI ActiveCell.Value
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMEnterKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
ActiveCell.Offset(1, 0).Select
.TransmitTerminalKey rcIBMF12Key
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.TransmitTerminalKey rcIBMF12Key
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
Loop
End With
Application.ScreenUpdating = True
Set Session = Nothing
End Sub