Application.worksheetfunction.index problem

BigDelGooner

Board Regular
Joined
Aug 17, 2009
Messages
197
Guys

I am getting the error message 'Type Mismatch' with the following line of code but can for the life of me see what I am doing wrong...

TEST = Application.WorksheetFunction.Index(Sec_Name, Workbooks(Wbk).Sheets("Position List").Range("Holding_Index"), 0)

Any ideas?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Did you declare TEST as a range? The line should start with Set TEST...

What does the Wbk variable contain, a string or a workbook object? If it is a string then Workbooks(Wbk).Sheets("Position List").Range("Holding_Index") still returns a range, not necessarily a numerical value...

What is Sec_Name, a range variable?

On the whole, there are an awful lot of names and variables in this code. A lot of things might need to be changed. Maybe try stepping through the code and checking at that line to see what all those different components evaluate to. Or try to accomplish this in a less complex way!
 
Upvote 0
Hi guys

Sorry for the delay I was out of the office.

Issue now sorted and thank you for your feedback.

Cheers :)
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,702
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top