View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
RobG RobG is offline
external usenet poster
 
Posts: 10
Default VBA equivalent for Excel "indirect()" function in UDF

Legend!

i ended up writing this which ismy first UDF. Cheers

Function RoboCell(Curcell As Range, ShtName As String, ColNum As Integer, _
RowNum As Integer)

'returns the value of the current cell location in another sheetname
'multiplied by the % in colnum * % in rownum

RoboCell = Sheets(ShtName).Range(Curcell.Address) * _
Sheets(ShtName).Cells(Curcell.Row, ColNum) * _
Sheets(ShtName).Cells(RowNum, Curcell.Row)

End Function

"joel" wrote:


I think something simple like this

Function IndirectSht(Target As Range, ShtName As String)
InDirectSht = Sheets(ShtName).Range(Target.Address)
End Function


Call with
=IndirectSht(A6,"sheet2")


The function will return the data in another sheet at the same range
that is specified on the current sheet.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=157454

Microsoft Office Help

.