View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
xcelion xcelion is offline
external usenet poster
 
Posts: 1
Default User Defined Fuction Returning Range Help


Hi Tim,

Sorry for the late reply.I was out of station .here is my udf


Function GetSalaryRange(strTitle As String) As Range
Dim wsCatLookup As Worksheet
Dim rngTemp, rngSalRng, rngTemp1 As Range
Dim rngVar As Range
Set wsCatLookup = ThisWorkbook.Sheets("CategoryLookup")
Set rngTemp = wsCatLookup.Range("A4:B19")
Set rngSalRng = wsCatLookup.Range("E4:G19")



'rngTemp.Select

strCategory = WorksheetFunction.VLookup(strTitle, rngTemp, 2
True)

Set rngVar = rngSalRng.Find(what:=strCategory,, LookAt:=xlWhole, _
LookIn:=xlValues).Offset(0, 1).Resize(1, 2)



Set GetSalaryRange = rngVar



End Functio

--
xcelio
-----------------------------------------------------------------------
xcelion's Profile: http://www.excelforum.com/member.php...fo&userid=1628
View this thread: http://www.excelforum.com/showthread.php?threadid=31373