Jump to content
jugador

Excel (Index & Match) function

Recommended Posts

Local $xlup = -4162
Local $iRow = $oWorkbook.ActiveSheet.Range("D65536").End($xlup).Row
Local $aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:A"), 1)

Local $myRange = $oWorkbook.ActiveSheet.Range("D1:D11")

For $i = 2 To $iRow 
    If $aResult[$i-1] <> ""
        $var = $oExcel.Application.Match($aResult[$i-1], $myRange, 0)
        MsgBox(0, "", $var)
    EndIf
Next
Local $var, $oValue
Local $oRange = $oExcel.ActiveSheet.Range("D:D")
Local $iRow = $oExcel.WorksheetFunction.CountA($oRange)

Local $myRange = $oWorkbook.ActiveSheet.Range("D1:D11")

For $i = 2 To $iRow 
    If $oWorkBook.ActiveSheet.Range("A" & $i).Value <> ""  Then
        $var = $oExcel.Application.Match($oWorkBook.ActiveSheet.Range("A" & $i).Value, $myRange, 0) 
        $oValue = $oExcel.Application.Index($oWorkBook.ActiveSheet.Range("E1:E11").Value, $var, 1) 
        MsgBox(0, "", $oValue)
    EndIf
Next

 

Edited by jugador

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...