excel vba - Use of Index funtion in VBA returning run-time error message -


i can't figure out why cog run-time returning run-time error message

unable index property worksheet function.

below code,

 function distance() integer   distance = application.worksheetfunction.index(workbooks("practice 1.xlsm").worksheets("sheet2").range("i11:p18"), range("k12"))   end function 

the index function needs range, row , column - 3 parameters. in case give two. if start new empty application, , write

?application.worksheetfunction.index(range("a1:c10"), range("d1"),range("d2")).address 

in immediate window, $a$2:$c$2, in case write 2 in d2 , 1 in e1.

or code this:

 function distance() integer   distance = application.worksheetfunction.index(workbooks("practice 1.xlsm").worksheets("sheet2").range("i11:p18"), range("k12"),1)   end function 

Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -