View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ducky ducky is offline
external usenet poster
 
Posts: 27
Default Trying to use INDEX function in VBA Code, compile error


Finny wrote:
The following formula works like a charm as a formula in sheet1.

stringvar = =
Application.WorksheetFunction.Index(sheet1!C1:HE58 6,MATCH('sheet2'!A1,sheet1!C1:C1000,0),MATCH('shee t2'!K9,sheet1!C1:FC1,0))

Try to use it in my macro and compile error states:

"Expected: line separator or )" and highlights the first colon at
":HE586,"

Are Index and Match valid forumulas to use in VBA?
I know the syntax is straight from excel built-in functions. Isn't that
what Application.WorksheetFunction demands?

Thanks


Not sure that i fully understand your question but i can tell you that
Application.WorksheetFunction doesn't include all of the functions
available to formulas (because there is a VBA function that will
already do it) have you looked into .address?

Hope this helps

AR