Scorpion Steve
Board Regular
- Joined
- Jun 5, 2011
- Messages
- 220
Hi all!
Happy New years to start of with.
I'm trying to use two different named ranges nested within a string using the INDEX/MATCH function.
I've tried everything and still getting errors:
Run-time error '13':
Type Mismatch
for:
&
Run-time error '1004':
Invalid number of arguments.
Code snippet:
Anyone got a clue?
Ta
Happy New years to start of with.
I'm trying to use two different named ranges nested within a string using the INDEX/MATCH function.
I've tried everything and still getting errors:
Run-time error '13':
Type Mismatch
for:
Code:
Application.WorksheetFunction.Index(SearchInput, rng1, Application.Match(SearchInput, rng2, 0, 1)) = ContactNo.Value
&
Run-time error '1004':
Invalid number of arguments.
Code:
Application.WorksheetFunction.Index(SearchInput, Range("rng1"), Application.Match(SearchInput, Range("rng2"), 0, 1)) = ContactNo.Value
Code snippet:
Code:
Dim rng1 As Range
Set rng1 = ActiveWorkbook.Names("PCIDRange").RefersToRange
Dim ws As Worksheet
Set ws = ActiveWorkbook.Names("PCIDRange").RefersToRange.Worksheet
Dim rng2 As Range
Set rng2 = ActiveWorkbook.Names("ContactNoRange").RefersToRange
Dim ws2 As Worksheet
Set ws2 = ActiveWorkbook.Names("ContactNoRange").RefersToRange.Worksheet
[COLOR=#0000ff]Application.WorksheetFunction.Index(SearchInput, rng1, Application.Match(SearchInput, rng2, 0, 1)) = ContactNo.Value[/COLOR]
End If
Ta