I've just written some code to check the lottery numbers, I have a large sindicate and need to check 16 columns of 6 numbers against the 6 lottery numbers that are placed in a row of six. Heres what I've got so far, the code works by checking every numbers in each row and returning the matched numbers as a number in a cell, this is very long winded and requires 2 macros as theres so much code. The code bellow shows the first two number to be checked, after that all that changes is the cell references. What I would like to do is condense it, say each column instead of each cell and returning the matched value, any one help please ?
Sub Lottery()
'Resets the counter'
Match = 0
NoMatch = 0
'looks at the 1st column & compares its value to 1st number'
If ActiveSheet.Cells(3, 2) = Cells(12, 2).Value Then
Match = Match + 1
Else: NoMatch = NoMatch + 0
End If
If ActiveSheet.Cells(4, 2) = Cells(12, 2).Value Then
Match = Match + 1
Else: NoMatch = NoMatch + 0
End If
So on and so forth !
Cheers Andy
Sub Lottery()
'Resets the counter'
Match = 0
NoMatch = 0
'looks at the 1st column & compares its value to 1st number'
If ActiveSheet.Cells(3, 2) = Cells(12, 2).Value Then
Match = Match + 1
Else: NoMatch = NoMatch + 0
End If
If ActiveSheet.Cells(4, 2) = Cells(12, 2).Value Then
Match = Match + 1
Else: NoMatch = NoMatch + 0
End If
So on and so forth !
Cheers Andy