View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Caroline Caroline is offline
external usenet poster
 
Posts: 183
Default problem building Function with worksheet name and range

hello,
I have a list of worksheets and would like to return certain values from
different ranges that I have named on each sheet
I have created this function by it does not work
=getvalue(G283,Parameter1,1,2) would return the value of row 1 column 2 in
range "Parameter1" in Sheetname written in G283.

Any idea? thanks a lot

Public Function GetValue(Ws As String, Pr As String, X As Double, Y As
Double) As Variant
Application.Volatile
Dim Ob1 As Object
Ob1 = Worksheets(Ws)
Dim Rn As Range
Set Rn = Ob1.Range(Pr)
GetValue = Rn(X, Y).Value
End Function
--
caroline