cornflakegirl
Well-known Member
- Joined
- Nov 4, 2004
- Messages
- 2,023
Two related questions in one.
I have this line of VBA:
sAgg and sRange are strings. sRange contains the name of a named range.
I originally had Application.WorksheetFunction.Match, but had to take WorksheetFunction out because the Match evaluates to error - is that the proper way to deal with that?
Also, this code is in a Worksheet_Change routine. My named range Range(sRange) is on a different worksheet. I originally tried to use just Range(sRange) but it errored until I defined which sheet it was on. Is there a way that I can use the named range without specifying the sheet? (I tried ActiveWorkbook.Range(sRange) but that didn't work either.)
I have this line of VBA:
Code:
If Not IsNumeric(Application.Match(sAgg, Sheet6.Range(sRange), 0)) Then Range("Product").Value = "All"
sAgg and sRange are strings. sRange contains the name of a named range.
I originally had Application.WorksheetFunction.Match, but had to take WorksheetFunction out because the Match evaluates to error - is that the proper way to deal with that?
Also, this code is in a Worksheet_Change routine. My named range Range(sRange) is on a different worksheet. I originally tried to use just Range(sRange) but it errored until I defined which sheet it was on. Is there a way that I can use the named range without specifying the sheet? (I tried ActiveWorkbook.Range(sRange) but that didn't work either.)