Thread: Range Problem
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Rowan Drummond
 
Posts: n/a
Default Range Problem

As it is your function is not passing a value back to the main
procedure. Try changing it to:

Function valcal(val, mrn)
Dim r, c As Integer
Dim yr As String
Dim fndCell As Range
With mrn
Set fndCell = .Find(What:=val, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext _
, MatchCase:=False)
If Not fndCell Is Nothing Then
r = fndCell.Row
c = fndCell.Column
yr = Cells(r, 1).Value
valcal = Right("0" & c, 2) & yr '<<changed
End If
End With
End Function

Hope this helps
Rowan

jesmin wrote:
Hi rown:

In the 2nd call, fndcell is empty. The range selection is perfect. Its
selecting the required columns. Only it canot find the value.

Thanks