+ Reply to Thread
Results 1 to 8 of 8

Create report compareing 2 Sheets

  1. #1
    Registered User
    Join Date
    04-27-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2003
    Posts
    7

    Create report compareing 2 Sheets

    Can you please help me with some ideas on following:

    Every day i create a attendence sheet with names, who was attening a club the last 21 days.
    I need some kind of report showing who is in Sheet1(Today) and not in Sheet2(Yesterday)="new people" and who is in Sheet2 but not in Sheet1 (people that stoped attending, droped out the list).

    I tryed with "countif" and "Vlookup" but have to change the formulars on two sheets every day and i would rather like to leave leave the Sheets untouched.

    Any ideas?
    Thanks in advance
    Last edited by Gero; 05-12-2009 at 07:14 PM. Reason: solved

  2. #2
    Forum Contributor
    Join Date
    10-16-2008
    Location
    Iowa
    Posts
    121

    Re: Create report compareing 2 Sheets

    If you run a macro, stored in your Personal.xlsb, on the sheets, it does not care about what version the sheets are so long as their names are the same, e.g., sheet1 and sheet2.

  3. #3
    Registered User
    Join Date
    04-27-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Create report compareing 2 Sheets

    The sheets to be compared have different names daily. I always compare today with yesterday, for examle (sheetnames: 120509 and 110509)
    I am able to locate the sheets with the names of todays and yesterday dates.
    But how do i do the marcro to find who is in sheet1 and not in sheet2 and who is in sheet2 but not in sheet1?
    I can only find macros that search for dublicates, but that does not help me.

  4. #4
    Registered User
    Join Date
    05-12-2009
    Location
    qc
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Create report compareing 2 Sheets

    Sub compare_two_column1()



    lastrow& = Sheets(1).Cells.find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
    i = 1
    Do Until lastrow = i
    Tag = Worksheets(1).Cells(i, 1)

    Set c = Worksheets(1).Range("b1", Worksheets(1).Cells(lastrow, 2)).find(Tag, LookIn:=xlValues)
    If c Is Nothing Then
    Worksheets(1).Cells(i, 1).Interior.Color = vbYellow
    End If

    i = i + 1


    Loop
    End Sub

    Sub compare_two_column2()



    lastrow& = Sheets(1).Cells.find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
    i = 1
    Do Until lastrow = i
    Tag = Worksheets(1).Cells(i, 2)

    Set c = Worksheets(1).Range("a1", Worksheets(1).Cells(lastrow, 1)).find(Tag, LookIn:=xlValues)
    If c Is Nothing Then
    Worksheets(1).Cells(i, 2).Interior.Color = vbYellow
    End If

    i = i + 1


    Loop
    End Sub



    compare two column and put some color on diffference if it not find

  5. #5
    Registered User
    Join Date
    04-27-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Create report compareing 2 Sheets

    wow, that looks good. I have the names in 2 different sheets, but i think i can figure that out.
    Thank you verry much for your response!
    I'm back to testing

  6. #6
    Registered User
    Join Date
    05-12-2009
    Location
    qc
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Create report compareing 2 Sheets

    i just find for you this function

    ActiveWindow.SelectedSheets

    so u can select two sheet from sheet tab (tab name) at the bottom with ctrl button and mouse. So you don't to enter in the vba to change sheet name

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-27-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Create report compareing 2 Sheets

    just tested the code you gave me, works like hell

    Please Login or Register  to view this content.
    Thank you, you saved my night! The "selctedsheet" is another big help.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Create report compareing 2 Sheets

    fou, please edit your post to add code tags.
    Entia non sunt multiplicanda sine necessitate

+ 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