Consulting

Results 1 to 3 of 3

Thread: Matching 2 columns

  1. #1
    VBAX Contributor
    Joined
    Jul 2017
    Posts
    110
    Location

    Matching 2 columns

    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
    Attached Files Attached Files

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    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).
    Attached Files Attached Files
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Contributor
    Joined
    Jul 2017
    Posts
    110
    Location
    Thanks p45cal....it is working now....Thanks a ton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •