I have the below code. That is running from EXCEL to SAP GUI
However, it is taking one cell at a time and loading.
I need it to take a larger range in the column (select 3 down in a column from the last three, etc).
I am at a loss on this one. any help?
Thank you for any help!
However, it is taking one cell at a time and loading.
I need it to take a larger range in the column (select 3 down in a column from the last three, etc).
I am at a loss on this one. any help?
VBA Code:
Dim row As Long 'Excel Workbook Row
Dim row1 As Integer 'SAP Fast Entry Row
Set tbl = excelApp.ActiveCell.CurrentRegion
myValue = InputBox("What is the starting line?", "Starting Line", "4")
SkipApplyToAll = 0
OverwriteApplyToAll = 0
With session
If Left(session.ActiveWindow.Text, 15) <> "ACCESS" Then
If session.ActiveWindow.Text = "Download file" Then
.findById("wnd[1]/tbar[0]/btn[3]").press
.findById("wnd[0]").sendVKey 12 'Sends Window to main screen
Else
.findById("wnd[0]").sendVKey 12 'Sends Window to main screen
End If
End If
.findById("wnd[0]/tbar[0]/okcd").Text = "1"
.findById("wnd[0]/tbar[0]/btn[0]").press
.findById("wnd[0]/usr/ctxtRV13A-KSCHL").Text = "2"
.findById("wnd[0]/tbar[1]/btn[17]").press
.findById("wnd[1]/usr/sub:SAPLV14A:0100/radRV130-SELKZ[1,0]").Select
'.findById("wnd[1]/usr/sub:SAPLV14A:0100/radRV130-SELKZ[1,0]").SetFocus
.findById("wnd[1]/tbar[0]/btn[0]").press
End With
For row = myValue To tbl.Rows.Count
row1 = 0
ReStrt:
Cust = tbl.Cells(row, 3).Value
With session
.findById("wnd[0]/usr/ctxtKOMG-VKORG").Text = tbl.Cells(row, 2).Value 'Sales Organization
.findById("wnd[0]/usr/ctxtKOMG-VTWEG").Text = "0" 'Distribution Channel
.findById("wnd[0]/usr/ctxtKOMG-KUNNR").Text = tbl.Cells(row, 3).Value 'Customer Number
.findById("wnd[0]/usr/ctxtKOMG-/SCL/BRAND").Text = tbl.Cells(ro).Value 'X
.findById("wnd[0]/usr/tblSAPMV13ATCTRL_FAST_ENTRY/ctxtKOMG-/SCL/PKG[0," & row1 & "]").Text = tbl.Cells(row, 5).Value 'Y
.findById("wnd[0]/usr/tblSAPMV13ATCTRL_FAST_ENTRY/txtKONP-KBETR[4," & row1 & "]").Text = tbl.Cells(row, 6).Value 'Z
.findById("wnd[0]/usr/tblSAPMV13ATCTRL_FAST_ENTRY/ctxtKONP-KMEIN[7," & row1 & "]").Text = tbl.Cells(row, 7).Value 'Condition Unit
.findById("wnd[0]/usr/tblSAPMV13ATCTRL_FAST_ENTRY/ctxtRV13A-DATAB[10," & row1 & "]").Text = tbl.Cells(row, 8).Text 'Start Date
.findById("wnd[0]/usr/tblSAPMV13ATCTRL_FAST_ENTRY/ctxtRV13A-DATBI[11," & row1 & "]").Text = tbl.Cells(row, 9).Text 'End Date
Thank you for any help!