Johnny C
Well-known Member
- Joined
- Nov 7, 2006
- Messages
- 1,069
- Office Version
- 365
- Platform
- Windows
Hi
I've got some VBA which is scanning a list of data on a number of files for errors.
Each workbook has a number of pages, including 1 called 'LookUps' and 1 called 'Query log'
The Query log page has a dynamic range, List_LOB which is defined by
List_LOB=OFFSET(LookUps!$R$1,1,0,COUNTA(LookUps!$R$2:$R$50000),1) in the name manager.
When I pick up a cell from the Query log sheet (into variable str_LOB) and try and match it (to see if it's a valid entry in the list in the Lookups sheet) VBA can't find a match. the value it's looking for is there, it's never matching anything.
(wksdatasheet is the Query log sheet, and as I said the range List_LOB is defined in Names manager on the Query log page)
If I do (to test the range)
then it ignores the range completely and colours the font on the active cell on the query log sheet yellow. I don't know if that's an invalid test or not. If I use the dynamic range in a formula on the worksheet in the Query log sheet, it works fine.
Can I access a range on an unselected sheet (which is hidden too) defined by a dynamic range using worksheetfunction.match?
I've got some VBA which is scanning a list of data on a number of files for errors.
Each workbook has a number of pages, including 1 called 'LookUps' and 1 called 'Query log'
The Query log page has a dynamic range, List_LOB which is defined by
List_LOB=OFFSET(LookUps!$R$1,1,0,COUNTA(LookUps!$R$2:$R$50000),1) in the name manager.
When I pick up a cell from the Query log sheet (into variable str_LOB) and try and match it (to see if it's a valid entry in the list in the Lookups sheet) VBA can't find a match. the value it's looking for is there, it's never matching anything.
Code:
lngLOBIndex = WorksheetFunction.Match(str_LOB, wkbkOpened.wksdatasheet.Range("List_LOB"), 0)
If I do (to test the range)
Code:
wkbkOpened.wksdatasheet.Range("List_LOB").select
With Selection.Font
.Color = -16711681
.TintAndShade = 0
End With
Can I access a range on an unselected sheet (which is hidden too) defined by a dynamic range using worksheetfunction.match?