Nomis_Eswod
Board Regular
- Joined
- Jul 27, 2005
- Messages
- 153
Hello,
I am doing some work in VBA and I have one last bit of coding to do that I can't work out.
Basically, on my Excel sheets there are bits of information called 'Keys'. The key codes are:
10
12
50
51
94
96
99
There are 2 places on the spreadsheet that use these keys, lets says Key1 is the first section and Key2 is the second. I have an If formula in the VBA to say that if Key1 = Key 2 then do the following. I need to amend this slightly though. What I need it to say is that If they are part of the same key group then do the following. Grouping is simple, there are 3 groups, 10 & 12, 50 & 51 and 94 & 96 & 99.
So for example,
But I don't want to have to write out every possible combination.
Any ideas??
I am doing some work in VBA and I have one last bit of coding to do that I can't work out.
Basically, on my Excel sheets there are bits of information called 'Keys'. The key codes are:
10
12
50
51
94
96
99
There are 2 places on the spreadsheet that use these keys, lets says Key1 is the first section and Key2 is the second. I have an If formula in the VBA to say that if Key1 = Key 2 then do the following. I need to amend this slightly though. What I need it to say is that If they are part of the same key group then do the following. Grouping is simple, there are 3 groups, 10 & 12, 50 & 51 and 94 & 96 & 99.
So for example,
Code:
if Key1 = 10 or 12 and Key2 = 10 or 12 Then
Do the following
End If
But I don't want to have to write out every possible combination.
Any ideas??