+ Reply to Thread
Results 1 to 5 of 5

Macro to Check if Cells Contain Matching Text

  1. #1
    Registered User
    Join Date
    06-06-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    38

    Macro to Check if Cells Contain Matching Text

    I am trying to compare cell values for data validation.
    One of the cells is a column header in a pivot table, and the other is just a cell. Each contains a word, and should be the same.

    I tried using this code

    Please Login or Register  to view this content.
    But I always get the error message, even if I know the cells match. I've also tried dimensioning the cells as integers.
    Why won't Excel recognize they equal the same thing?

    Thank you in advance!

  2. #2
    Registered User
    Join Date
    10-11-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2002
    Posts
    71

    Re: Macro to Check if Cells Contain Matching Text

    Hey,
    Try this, I assume they are ints?

    Please Login or Register  to view this content.
    In your script you declare your variables as the value "E1,E2" and not the cell E1, E2.
    Last edited by christopherL; 10-24-2013 at 10:31 AM.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Macro to Check if Cells Contain Matching Text

    If they are words (string) declaring them as Integers isn't going to work. With that being said, why even declare them at all? Try:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-11-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2002
    Posts
    71

    Re: Macro to Check if Cells Contain Matching Text

    Ahh yes that is better

  5. #5
    Registered User
    Join Date
    06-06-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Macro to Check if Cells Contain Matching Text

    beautiful!! thank you so much!
    And now I've learned something new =)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 09-07-2013, 07:50 PM
  2. [SOLVED] TEXT Formula to identify rows of cells with Matching TEXT *** Actual Worksheet attached.
    By steve08087 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-29-2013, 12:42 PM
  3. [SOLVED] Search text in cells, find matching text based on list, remove all but one entry
    By adam_mc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-30-2013, 12:50 PM
  4. [SOLVED] Find complex name in range and check off matching cells
    By Durarara in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-07-2012, 01:54 PM
  5. Replies: 3
    Last Post: 01-31-2012, 12:40 PM

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