Skip to Content
0

Find each cell value in range to SAP Table (GridView)

Feb 15 at 08:40 AM

47

avatar image
Former Member

I'm trying to look for a specific text from my excel file to a SAP table.

I have tried below code but it gives me error "Invalid Next Control variable reference"

So far below is my code:

<code>set rLastRow = rSheet.Cells(rSheet.rows.Count,"AO").End(xlUp).Row
Set Table = session.FindById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell")

rows = Table.RowCount -1
cols = Table.RowCount -1Dim columns AsObjectSet columns = Table.ColumnOrder

For i =0 To rows

For j =2 To rLastRow
If rSheet.Cells(j,"AO").Value = Table.GetCellValue(i, columns(3))Then

 MsgBox "Found!"& rSheet.Cells(j,"AO").Value & Table.GetCellValue(i, columns(3)), vbOKOnly

Else

'proceed to next value to find

End If
Next i

Next j

What I'm trying to do is for each cell in range "AO" in excel, it will look for a match in my GridView (SAP: fbl3n).

Is there another way where can I loop to each cell from range (excel) and look for it in a SAP table (GridView)?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers