PDA

View Full Version : [SOLVED] Matching 2 columns



Veeru
08-29-2018, 02:17 AM
Hi,
I am looking for help where in Confirm code it is giving me error "Invalid reference" . What we are trying to find out when my col. C is equal to Col. D then it gives me message "ALL updated".

Can anyone please look into this.

Sample file attached.
Thanks

p45cal
08-29-2018, 09:51 AM
Try:
Sub Confirm()
On Error Resume Next
With Sheets("Check sheet")
c_count = WorksheetFunction.CountA(.Range("C6:C99"))
d_count = WorksheetFunction.Count(.Range("D6:D99"))
If c_count = d_count Then
MsgBox " All updated"
End If
End With
End Sub
In the attached I've changed Count to CountA in the code since in column C you're not counting numbers but non-empty cells (Sheet names).
Column D contains dates so they'll be numbers so I've left that as is.
I've put temporary formulae in cells H6:I6 just to show you, delete them after you've seen what happens when you change H6 fromula from =COUNT(C6:C99) to =COUNTA(C6:C99).

Veeru
08-29-2018, 09:27 PM
Thanks p45cal....it is working now....Thanks a ton