Hi and thanks in advance!
I am trying to create a UDF
My UDF does not work:
my UDF does not work, iguess by my variables you know what I am expecting
Thanks again
I am trying to create a UDF
My UDF does not work:
Code:
Function myUDF(rSCORE As Range, rYEAR As Range, rGENDER As Range, Select_SHEET As Range)
Dim lObj As ListObject
Dim wSHT As String: wSHT = Select_SHEET.Parent.Name
Dim wYEAR As String: wYEAR = rYEAR
dim wScore as String: wScore= rSCORE
dim wGender as string: wGender=lCase(Right(rGENDER,2))
Dim rTable As Range
Dim rCol As Range
Dim rRow As Range
For Each lObj In Sheets(wSHT).ListObjects
If LCase(Right(lObj, 2)) = wGender Then
Set rTable = lObj.Range
Set rCol = rTable.Columns(1): Set rRow = rTable.Rows(1)
Exit For
End If
Next lObj
xRow = Application.WorksheetFunction.Match(wYEAR, rCol)
xCOL = Application.WorksheetFunction.Match(SCORE, rTable.Rows(xRow))
myUDF = rRow.Cells(xCOL)
End Function
my UDF does not work, iguess by my variables you know what I am expecting
Thanks again