dan_l
Active Member
So, I have a VBA function:
Based on parameter 1, I want to select a range to match parameter 2.
function myfunction(parameter1 as string, parameter2 as string)
dim rMyRange as range
dim Match as string
Select Case Parameter1
case "A"
rMyRange = range("FirstRange")
case "B"
rMyRange = range("SecondRange")
myfunction = application.worksheetfunction.match(parameter2,rmyrange,0)
end function
But, it doesn't seem to work. I'm relative certain I have to do something with the ranges differently but I'm unsure what.
maybe rmyrange = range(firstrange").address or something?
Based on parameter 1, I want to select a range to match parameter 2.
function myfunction(parameter1 as string, parameter2 as string)
dim rMyRange as range
dim Match as string
Select Case Parameter1
case "A"
rMyRange = range("FirstRange")
case "B"
rMyRange = range("SecondRange")
myfunction = application.worksheetfunction.match(parameter2,rmyrange,0)
end function
But, it doesn't seem to work. I'm relative certain I have to do something with the ranges differently but I'm unsure what.
maybe rmyrange = range(firstrange").address or something?