+ Reply to Thread
Results 1 to 2 of 2

Compare values in column a to column b, and put it in column c if they match

Hybrid View

lesoies Compare values in column a to... 04-26-2013, 07:51 PM
FDibbins Re: Compare values in column... 04-26-2013, 07:52 PM
  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    Compare values in column a to column b, and put it in column c if they match

    i'm trying to compare a value from column a to every value in column b, if they match, then copy that value to column c

    right now i have a function that will check column b and return a true/false if you send it a value to match it
    trying to figure out how i can run a function in to then take the true/false function and copy the first column value to column c

    any help would be appreciated

    thanks
    Function IsInListB(theWord As String)
        'it returns true if a match is found
        'it returns false if a match is not found
            
        Dim isMatch As Boolean
        isMatch = False                         'assuming not in list at the beginning
            
        Range("B2").Select
        Do While ActiveCell.Value <> ""         'continue checking as long as column B is not blank
            If ActiveCell.Value = theWord Then  'got a match
                isMatch = True                  'so set isMatch to true
            End If
            ActiveCell.Offset(1, 0).Select      'go down one cell in column B
        Loop
        
        IsInListB = isMatch                     'send true or false to calling sub procedure
        
    End Function
    Attached Files Attached Files
    Last edited by lesoies; 04-26-2013 at 07:55 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Compare values in column a to column b, and put it in column c if they match

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1