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

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -