+ Reply to Thread
Results 1 to 3 of 3

VBA to check if cell A1 in workbook 1 equals cell A1 in workbook 2

  1. #1
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    VBA to check if cell A1 in workbook 1 equals cell A1 in workbook 2

    Hi,
    I have two workbooks open at the same time.

    I would like to have a simple IF statement that checks whether cells match on both workbooks.

    Ideally, it would work similar to this (which doesn't work BTW):

    Please Login or Register  to view this content.
    Is there is a way to modify the IF statement so that the WORKBOOK_1_NAME & range work? If it's not possible, what would be the easiest way to accomplish it?

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: VBA to check if cell A1 in workbook 1 equals cell A1 in workbook 2

    Yes there is a way.

    So read through this to learn about workbooks, worksheets, and ranges.
    http://www.excel-easy.com/vba/workbo...et-object.html

    Basically you want to use an excel cell to define the workbook
    then you can use a variable to define it, then use the variable to drop into the needed code.


    Please Login or Register  to view this content.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    Re: VBA to check if cell A1 in workbook 1 equals cell A1 in workbook 2

    I tried the code you posted, but couldn't get it to work. I then clicked on the link you posted, amended my original code a little bit, and whala; it worked! THANKS FOR THE HELP!

    Here is what I ended up with:

    Please Login or Register  to view this content.

+ 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. [SOLVED] Check if any cell in range contains value and copy that value to another workbook
    By henr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2014, 07:11 AM
  2. [SOLVED] Code to copy data from another workbook where offset cell equals "none"
    By Nitefox in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-20-2014, 01:33 PM
  3. A function to check if a cell is populated when the workbook is opened
    By JamesGoulding85 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-04-2013, 05:10 AM
  4. Macros to check if any cell value has changed before closing workbook
    By sasmit0905 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2013, 09:14 AM
  5. check cell values from other workbook
    By darkbraids in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2012, 10:25 AM

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