+ Reply to Thread
Results 1 to 6 of 6

Help defining range for macro comparing values in 2 columns and worksheets

  1. #1
    Registered User
    Join Date
    04-12-2014
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    8

    Help defining range for macro comparing values in 2 columns and worksheets

    Hi, hoping someone can help me. I have an excel workbook with 2 worksheets, 'Source' and 'Master'. When a command button is clicked on the Master worksheet, a macro is run to compare the values in 2 specific columns on the 2 worksheets and paste any values that is not in column 'A' on the Source worksheet in the next available row in column 'D' on the Master worksheet along with the associated data in that row from columns 'B', 'C' and 'D' on the source worksheet. (rows A, B and C on the master remain blank). Right now, only 2 of the values from the source worksheet is being copied to column D on the master worksheet. The values missing from the master worksheet are in red on the source sheet...so this is what I would expect would be copied to the master worksheet. If someone can let me know why the entire range of column A on the source sheet is not being taken into consideration for the compare, I'd appreciate it. I've attached a sample of the workbook which has the code I'm using for review. Thanks in advance.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Help defining range for macro comparing values in 2 columns and worksheets

    I thought you can filter "closed" in col. D in source and copy that.
    But you have filtered both rows 6 and 16 in source though column D is closed. what is the logic.
    is the red color the only condition???????????
    I am not an expert. better solutions may be available
    [email protected]

  3. #3
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Help defining range for macro comparing values in 2 columns and worksheets

    I thought you can filter "closed" in col. D in source and copy that.
    But you have filtered both rows 6 and 16 in source though column D is closed. what is the logic.
    is the red color the only condition???????????

  4. #4
    Registered User
    Join Date
    04-12-2014
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Help defining range for macro comparing values in 2 columns and worksheets

    No, red is not a condition. The text will typically be black. I just did that to make it easier for me to identify which values were missing from the Master sheet. Column D's value will also vary. So I was only looking to match column A on source with D on master.

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Help defining range for macro comparing values in 2 columns and worksheets

    hi 4lysaabri, option, please check attachment, press "Refresh" button
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-12-2014
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Help defining range for macro comparing values in 2 columns and worksheets

    Hi watersev, Wow!! You've solved all of my problems. Thank you so much. By the looks of your code, I would have never gotten the results I was looking for without you. Thank you again!!

+ 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. macro for conditional formatting based on the comparing values from adjacent columns
    By jkmasurkar in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-18-2012, 07:18 AM
  2. [SOLVED] Help: Defining a variable with an array of worksheets that use the same range
    By paulw793 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2012, 03:34 PM
  3. Replies: 4
    Last Post: 08-08-2012, 01:21 AM
  4. Defining a Range over Multiple Worksheets
    By Tacitus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-23-2011, 09:14 PM
  5. [SOLVED] Defining Range of For Each Loop for Cells and Worksheets
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2005, 09:06 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