Kriskros07
New Member
- Joined
- Sep 1, 2011
- Messages
- 11
Hi, I am in dire need of some assistance. I have scoured the existing posts but cant quite find the right post to twig with me what i need to do.
I am trying to write a macro which will search on 2 pieces of data taken from e.g. Row1, i.e. cells A1 and B1 and match those to 2 pieces of data (found together) in another part of the spreadsheet e.g. these might be in cells N7 and O7. I want the code to return the position of the matched data (presumably using Match) - so this would be 7 if it matched the data with cells N7 and O7(it could be matched anywhere in these columns of course). A seperate issue - but just to explain why i am trying to do this - I will subsequently use this positioning to compare the remaining columns of data (e.g. compare in this instance A1:M1 against N7:Z7).
A Single criteria is easy enough:
where a is the value found in cell A1
relpos = Application.Match(a, Range("N:N"), 0) 'single criteria
however, i need to add in cells B1 to the reference argument and Range O:O to the lookup array.
I believe i need to use the Evaluate function also to do this in VBA. And Index maybe??
Any help will be very much appreciated!
Kind Regards,
Chris
I am trying to write a macro which will search on 2 pieces of data taken from e.g. Row1, i.e. cells A1 and B1 and match those to 2 pieces of data (found together) in another part of the spreadsheet e.g. these might be in cells N7 and O7. I want the code to return the position of the matched data (presumably using Match) - so this would be 7 if it matched the data with cells N7 and O7(it could be matched anywhere in these columns of course). A seperate issue - but just to explain why i am trying to do this - I will subsequently use this positioning to compare the remaining columns of data (e.g. compare in this instance A1:M1 against N7:Z7).
A Single criteria is easy enough:
where a is the value found in cell A1
relpos = Application.Match(a, Range("N:N"), 0) 'single criteria
however, i need to add in cells B1 to the reference argument and Range O:O to the lookup array.
I believe i need to use the Evaluate function also to do this in VBA. And Index maybe??
Any help will be very much appreciated!
Kind Regards,
Chris