View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default index function in vba

On Sat, 9 Mar 2013 10:24:12 -0800 (PST), oercim wrote:

Hello, I have a problem in vba. I am trying to use index function(which is an excel function) in vba. Let the function to be:


Function myfunc(a As Range)
mayfunc = Index(a, 1, 2)
End Function

However I get such an error "sub of function undefined" by highlighting "Index". In vba isn't index function defined? If not, what is its counterpart in vba? Thanks a lot. Best regards.


If you want to use an Excel function within VBA, you need to be specific (in computer talk). Not all Excel functions are useable within VBA.

Try WorksheetFunction.Index(...)