cheque book Bank Data
Date cheque no amount matching cheque in bank date cheque no amount
01/10/2009 692201 40000 no match 01/10/2009 692203 23000
02/10/2009 692202 50000 no match 05/10/2009 692201 40000
03/10/2009 692203 23000 no match 06/10/2009 692205 51000
04/10/2009 692204 29000 no match 09/10/2009 692202 50000
05/10/2009 692205 51000 no match 08/10/2009 692204 29000
06/10/2009 692206 35000 no match 11/10/2009 692206 35000
07/10/2009 692207 15000 no match 08/10/2009 692208 1
08/10/2009 692208 20010 no match
09/10/2009 692209 5130 no match 07/10/2009 692207 15000
10/10/2009 692210 12 no match 13/10/2009 692213 1500
11/10/2009 692211 1500 no match
12/10/2009 692212 1500 no match
13/10/2009 692213 1500 no match
hi I am trying to write code for column D using a loop by comparing column B to column F. where the two do not match i want to insert " not match", if the two match but the amounts in columns C and G I want to give Ref number and state that the "refs match" .
if they refs in column B and F and amounts match in columns C and G I want to write the reference only.
my VBA code so far is below but is not quite working - and is only producing "no match":
Sub bankreconciliation()
Dim x, y As Integer
For x = 3 To Cells(Rows.Count, 1).End(xlUp).Row
For y = 3 To Cells(Rows.Count, 1).End(xlUp).Row
If Cells(x, 2) <> Cells(y, 6) Then
Cells(x, 4) = " no match"
ElseIf Cells(x, 2) = Cells(y, 6) Then
Cells(x, 4) = Cells(y, 6) & " REFS MATCH"
ElseIf Cells(x, 2) = Cells(y, 6) And Cells(x, 3) = Cells(y, 7) Then
Cells(x, 4) = Cells(y, 6)
End If
Next y
Next x
End Sub
Date cheque no amount matching cheque in bank date cheque no amount
01/10/2009 692201 40000 no match 01/10/2009 692203 23000
02/10/2009 692202 50000 no match 05/10/2009 692201 40000
03/10/2009 692203 23000 no match 06/10/2009 692205 51000
04/10/2009 692204 29000 no match 09/10/2009 692202 50000
05/10/2009 692205 51000 no match 08/10/2009 692204 29000
06/10/2009 692206 35000 no match 11/10/2009 692206 35000
07/10/2009 692207 15000 no match 08/10/2009 692208 1
08/10/2009 692208 20010 no match
09/10/2009 692209 5130 no match 07/10/2009 692207 15000
10/10/2009 692210 12 no match 13/10/2009 692213 1500
11/10/2009 692211 1500 no match
12/10/2009 692212 1500 no match
13/10/2009 692213 1500 no match
hi I am trying to write code for column D using a loop by comparing column B to column F. where the two do not match i want to insert " not match", if the two match but the amounts in columns C and G I want to give Ref number and state that the "refs match" .
if they refs in column B and F and amounts match in columns C and G I want to write the reference only.
my VBA code so far is below but is not quite working - and is only producing "no match":
Sub bankreconciliation()
Dim x, y As Integer
For x = 3 To Cells(Rows.Count, 1).End(xlUp).Row
For y = 3 To Cells(Rows.Count, 1).End(xlUp).Row
If Cells(x, 2) <> Cells(y, 6) Then
Cells(x, 4) = " no match"
ElseIf Cells(x, 2) = Cells(y, 6) Then
Cells(x, 4) = Cells(y, 6) & " REFS MATCH"
ElseIf Cells(x, 2) = Cells(y, 6) And Cells(x, 3) = Cells(y, 7) Then
Cells(x, 4) = Cells(y, 6)
End If
Next y
Next x
End Sub