Page 5 of 55 FirstFirst ... 3456715 ... LastLast
Results 41 to 50 of 541

Thread: Appendix Thread. 3 *

  1. #41
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10

    Testing Hyperlinks in received EMail

    Testing codes in support of this Thread
    http://www.excelfox.com/forum/showth...0727#post10727







    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=UgxzpgHWTLGj0C3q3gx4AaABAg. 9gxsUMU53al9k5c8W6QGE8
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=Ugz2PzvZTJyxHz70eVF4AaABAg. 9gxDYq2iiZ89h4ISxLD17d
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=Ugz2PzvZTJyxHz70eVF4AaABAg. 9gxDYq2iiZ89h4LdsDETim
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=Ugz2PzvZTJyxHz70eVF4AaABAg. 9gxDYq2iiZ89h32czjtyR_
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=UgxzpgHWTLGj0C3q3gx4AaABAg
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=Ugw_smEwvNffCPr_nrB4AaABAg. 9gvyL53lI1l9gxwd_9-V6z
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=Ugy7vmiHsQ0oUt2QCPZ4AaABAg. 9gvoy4OW6lU9gxwxC5-rL9
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=UgzuX3uYmqJRtsZIbqF4AaABAg. 9gth61YhXKB9gxxCMdRLA0
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=UgxcPC64RQGmXwO5rft4AaABAg. 9gtQLXaeg0e9gxxNuc5CCM
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=UgwCY8vOs1DFHgYSJwF4AaABAg. 9godrFcyWYw9gxy1odpiRj
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=UgyL5nh_j8w70-YBoUt4AaABAg.9goMcRjwjtc9gxyslvuZKx
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=UgwwWRgmRZNqJKptHR14AaABAg. 9go-DbayTZa9gxzPbefHXf
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=UgwF3wECwc8tVoRmz6B4AaABAg. 9go-5xLQM8P9gxzmB7nkVQ
    https://www.youtube.com/watch?v=xLCWtC6UYrM&lc=UgyRDmGTHnMdT7dl_qx4AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA


    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgxUbeYSvsBH2Gianox4AaABAg. 9VYH-07VTyW9gJV5fDAZNe
    https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgxLtKj969oiIu7zNb94AaABAg
    https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgyhQ73u0C3V4bEPhYB4AaABAg
    https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgzIElpI5OFExnUyrk14AaABAg. 9fsvd9zwZii9gMUka-NbIZ
    https://www.youtube.com/watch?v=jdPeMPT98QU
    https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  2. #42
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10
    Code for Thai .
    Code:
    Option Explicit
    Sub Sendfromexcellearninggmail()
    Rem 6 EMail send 'For info see:  http://www.excelfox.com/forum/showthread.php/2233-Urgent-support-needed-Multiple-emails-multiple-Excel-workbooks-at-once#post10519
    'Working at my end With my With End With Created LCDCW Library, (LCD 1.0 Library ) (Linking Configuration Data_Cods Wollups)
        '6a(i)
        With CreateObject("CDO.Message") ' -Linking Cods Wollups--------
        Dim LCD_CW As String: Let LCD_CW = "http://schemas.microsoft.com/cdo/configuration/"
         .Configuration(LCD_CW & "smtpusessl") = True '
         .Configuration(LCD_CW & "smtpauthenticate") = 1  '
        '  ' Sever info
         .Configuration(LCD_CW & "smtpserver") = "smtp.gmail.com" ' "smtp.office365.com" ' "smtp.live.com" ' "smtp-mail.outlook.com" ' "smtp.live.com" ' "smtp.gmail.com" ' "securesmtp.t-online.de" "smtp.mail.yahoo.com" "smtp.live.com" "pod51017.outlook.com"  "smtp-mail.outlook.com" "smtp.live.com"  "securesmtp.t-online.de"
        '  The mechanism to use to send messages.
         .Configuration(LCD_CW & "sendusing") = 2  '  Based on the LCD_OLE Data Base of type DBTYPE_I4
         .Configuration(LCD_CW & "smtpserverport") = 465 ' 465 or 25 for gmail '587 ' 25  ' 465 or 25 for t-online.de 'or 587 'or 25
        '
         .Configuration(LCD_CW & "sendusername") = "excellearning12@gmail.com" '
         .Configuration(LCD_CW & "sendpassword") = "xxxxxxxxxxxxx"       '                                  '
    '     .Configuration(LCD_CW & "sendusername") = "YourEMailAddress"
    '     .Configuration(LCD_CW & "sendpassword") = "YourEMailPassword"
        ' Optional - How long to try
         .Configuration(LCD_CW & "smtpconnectiontimeout") = 30 '
        ' Intraction protocol is Set/ Updated
         .Configuration.Fields.Update '
        'End With 6a(i)' ----------------------        my Created  LCDCW Library
        '6a(ii) With   ' -- ' Data to be sent---       my Created  LCDCW Library
         Dim strHTML As String: Let strHTML = "<font size=""3"" face=""Calibri"">" & _
         "This is sent from EMail account:" & _
         "<br>Username: ""excellearning12@gmail.com""" & _
         "<br>Password: ""xxxxxxxxxxxxx""" & _
         "<br><br>" & _
         "<br>Please click on the 5 links below and tell me what happens, thanks!" & _
         "<br>1 <A HREF=""https://app.box.com/s/x01liz3ralbdrt152i52fpwb0wx40ff3"">link to box net cloud free file sharing</A>" & _
         "<br>2 <A HREF=""file://" & ThisWorkbook.Path & "\" & "Test file DOThtm to be stored on your computer to try to open with a Hyperlink in a received EMail.htm"""">htm file on your computer</A>" & _
         "<br>3 <A HREF=""file://" & ThisWorkbook.Path & "\" & "Test file DOThtm to be stored on your computer to try to open with a Hyperlink in a received EMail.htm"""">htm file on your computer</A>" & _
         "<br>4 <A HREF=""file://" & ThisWorkbook.Path & "\" & "Empty test file DOTxls stored on your computer to try to open from Hyperlink in arrived Email.xls"""">empty xls file on your computer</A>" & _
         "<br>5 <A HREF=""file:///" & ThisWorkbook.Path & "\" & "Empty test file DOTxls stored on your computer to try to open from Hyperlink in arrived Email.xls"""">empty xls file on your computer</A>"
        .To = "THai xxxxxxxxx"
        '.CC = "xxxxxxxxxxxxx"
        .BCC = ""
        .from = """excellearning12@gmail.com"" <excellearning12@gmail.com>"
        .Subject = "Sent from EMail address: excellearning12@gmail.com"
        .htmlbody = strHTML
    
        .Send ' Do it
        End With ' 6a(ii) CreateObject("CDO.Message") ---my Created  LCDCW Library
    End Sub
    Testing files( sent privately ) :
    I have also posted 3 files to you using our share g mail account , ExcelVBAExp@gmail.com
    Please can you also try out the test…

    Please do the following.

    _1) Download all three files , and important: All must be stored in the same Folder.
    ( the three files are:
    Test file DOThtm to be stored on your computer to try to open with a Hyperlink in a received Email.htm
    Empty test file DOTxls stored on your computer to try to open from Hyperlink in arrived Email.xls
    Test File Thai to send EMail containing Hyperlinks to Files.xlsm
    )

    _2) Open only file Test File Thai to send EMail containing Hyperlinks to Files.xlsm
    Run code Sub Sendfromexcellearninggmail()

    You should receive an Email similar to these:
    Alan 5 Links in German Telekom.JPG : https://imgur.com/LeASbhf
    Attachment 2079
    Alan 5 Links in gmail.JPG : https://imgur.com/0sdyZEj
    Attachment 2080

    _3) Please click on the links.

    _4) Please reply and tell me what happens when you click each link

    Thanks
    Alan
    Attached Images Attached Images
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  3. #43
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10
    First test code for solution to this thread:
    http://www.excelfox.com/forum/showth...le-or-two-tabs

    ( Run code Sub TestieCalls() )

    Code:
    Option Explicit
    Sub TestieCalls()
     Call Testie(Worksheets("Sheet1"), Worksheets("Sheet2"))
    End Sub
    Sub Testie(Ws1 As Worksheet, Ws2 As Worksheet)
    Rem 1 Worksheet data info
    '1a capture data
    '1a(i) last data rows
    Dim lr1_1 As Long, Lr1_2 As Long, Lr2_1 As Long, Lr2_2 As Long, Lr1 As Long, lr2 As Long
     Let lr1_1 = Ws1.Cells(Rows.Count, 1).End(xlUp).row
     Let Lr1_2 = Ws1.Cells(Rows.Count, 2).End(xlUp).row: Lr2_1 = Ws2.Cells(Rows.Count, 1).End(xlUp).row: Lr2_2 = Ws2.Cells(Rows.Count, 2).End(xlUp).row
        If lr1_1 > Lr1_2 Then
         Let Lr1 = lr1_1
        Else
         Let Lr1 = Lr1_2
        End If
     Let lr2 = Lr2_2: If Lr2_1 > Lr2_2 Then Let lr2 = Lr2_1
    '1a(ii) capture data into arrays in one go
    Dim arrSht1() As Variant, arrSht2() As Variant
     Let arrSht1() = Ws1.Range("A1:B" & Lr1 & "").Value
     Let arrSht2() = Ws2.Range("A1:B" & lr2 & "").Value
    Rem 2 arrays for check and output
    Dim arrSht1b() As String, arrOut() As String
    '2a size arrays to that of sheet 2 data
     ReDim arrSht1b(1 To UBound(arrSht2(), 1), 1 To UBound(arrSht2(), 2))
     ReDim arrOut(1 To UBound(arrSht2(), 1), 1 To UBound(arrSht2(), 2))
    '2b fill modified sheet 1 array, arrSht1b() , initially with sheet 1 data
    Dim Cnt As Long
        For Cnt = 1 To UBound(arrSht1(), 1) Step 1
         Let arrSht1b(Cnt, 1) = arrSht1(Cnt, 1): Let arrSht1b(Cnt, 2) = arrSht1(Cnt, 2)
        Next Cnt
    Rem 3 main loop   ' == Start main loop ==========
        For Cnt = 1 To UBound(arrSht2(), 1) - 1 Step 1 ' Counting at each row
        Dim DifCnt As Long 'Count of different cells
            ' Condition check
            If (arrSht2(Cnt, 1) <> arrSht1b(Cnt, 1) Or arrSht2(Cnt, 2) <> arrSht1b(Cnt, 2)) And (arrSht2(Cnt + 1, 1) = arrSht1b(Cnt + 1, 1) And arrSht2(Cnt + 1, 2) = arrSht1b(Cnt + 1, 2)) Then  ' condition for changed row but next row is as previous : row had data changed, but a row was not inserted
             Let arrSht1b(Cnt, 1) = arrSht2(Cnt, 1): arrSht1b(Cnt, 2) = arrSht2(Cnt, 2) 'change any changed cell
                If arrSht1b(Cnt, 1) <> arrSht1(Cnt, 1) Then
                 Let arrOut(Cnt, 1) = arrSht1b(Cnt, 1) & "  <>  " & arrSht1(Cnt, 1)
                 Let DifCnt = DifCnt + 1
                Else: End If
                If arrSht1b(Cnt, 2) <> arrSht1(Cnt, 2) Then
                 Let arrOut(Cnt, 2) = arrSht1b(Cnt, 2) & "  <>  " & arrSht1(Cnt, 2)
                 Let DifCnt = DifCnt + 1
                Else: End If
            ' Condition check
            ElseIf ((arrSht2(Cnt, 1) <> arrSht1b(Cnt, 1) Or arrSht2(Cnt, 2) <> arrSht1b(Cnt, 2)) And (arrSht2(Cnt + 1, 1) <> arrSht1b(Cnt + 1, 1) Or arrSht2(Cnt + 1, 2) <> arrSht1b(Cnt + 1, 2))) Then   ' main condition suggesting added new row
            Dim AdedRows As Long: Let AdedRows = AdedRows + 1
            '3b we need to shift all data down to allow space for new row in arrSht2()
            Dim CntIn As Long
                For CntIn = (UBound(arrSht2(), 1) - 1) To Cnt Step -1 'loop for all but last from this row
                 Let arrSht1b(CntIn + 1, 1) = arrSht1b(CntIn, 1): arrSht1b(CntIn + 1, 2) = arrSht1b(CntIn, 2) ' This effectively pulls up each row by one
                Next CntIn
            '3c add the new data to the modified array, Let arrSht1b()
             Let arrSht1b(Cnt, 1) = arrSht2(Cnt, 1): arrSht1b(Cnt, 2) = arrSht2(Cnt, 2)
                If arrSht1b(Cnt, 1) = "" Then arrSht1b(Cnt, 1) = "           " ' Just to make final output more neat
                If arrSht1b(Cnt, 2) = "" Then arrSht1b(Cnt, 2) = "           "
            '3d add info to the output array
                If Cnt > UBound(arrSht1(), 1) Then ' case of new lines
                 Let arrOut(Cnt, 1) = "An new extra line contains  " & arrSht1b(Cnt, 1): arrOut(Cnt, 2) = "An new extra line contains  " & arrSht1b(Cnt, 2)
                
                Else
                   If arrSht1b(Cnt, 1) <> arrSht1(Cnt, 1) Then
                    Let arrOut(Cnt, 1) = arrSht1b(Cnt, 1) & "  <>  " & arrSht1(Cnt, 1)
                    Let DifCnt = DifCnt + 1
                   Else: End If
                   If arrSht1b(Cnt, 2) <> arrSht1(Cnt, 2) Then
                    Let arrOut(Cnt, 2) = arrSht1b(Cnt, 2) & "  <>  " & arrSht1(Cnt, 2)
                    Let DifCnt = DifCnt + 1
                   Else: End If
                End If
            '
             Let Cnt = Cnt + 1 ' we need to skip the next row as that was just effectively added so we are done with it
            Else ' row has not been added here
             
            End If
        Next Cnt ' ========= End main loop ==========
    Rem 4 last row may be new
        If arrSht2(lr2, 1) <> arrSht1(Lr1, 1) Or arrSht2(lr2, 2) <> arrSht1(Lr1, 2) Then ' either cell in last row is different
            If arrSht2(lr2, 1) <> arrSht1(Lr1, 1) Then
             Let arrOut(lr2, 1) = arrSht2(lr2, 1) & "  on last row is new"
             Let DifCnt = DifCnt + 1
            Else: End If
            If arrSht2(lr2, 2) <> arrSht1(Lr1, 2) Then
             Let arrOut(lr2, 2) = arrSht2(lr2, 2) & "  on last row is new"
             Let DifCnt = DifCnt + 1
            Else: End If
        Else 'last row on sheet2 is as on sheet1
        End If
    Rem 5 Output in new file For testing purposes, I give the output in a third worksheet, Tabelle3  
    Dim Ws3 As Worksheet: Set Ws3 = ThisWorkbook.Worksheets("Tabelle3")
     Ws3.Cells.ClearContents
     Let Ws3.Range("A1:B1").Value = "Sheet1": Ws3.Range("C1:D1").Value = "Test Output": Ws3.Range("E1:F1").Value = "Sheet2"
     Let Ws3.Range("A2").Resize(UBound(arrSht1(), 1), UBound(arrSht1(), 2)).Value = arrSht1()
     Let Ws3.Range("C2").Resize(UBound(arrOut(), 1), UBound(arrOut(), 2)).Value = arrOut()
     Let Ws3.Range("E2").Resize(UBound(arrSht2(), 1), UBound(arrSht2(), 2)).Value = arrSht2()
     Ws3.Columns.AutoFit
    Rem 6 MsgBoox output
     MsgBox Prompt:="inserted lines is   " & AdedRows & vbCrLf & "Changed cells is  " & DifCnt
    End Sub




    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgxesLhWNr_zNP0GUdh4AaABAg.9hI1CQJMLLo9hWn2pGBe SS
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgzkRujoMw9PblmXDQ14AaABAg.9hJRnEjxQrd9hJoCjomN I2
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgzPZbG7OvUkh35nXDd4AaABAg.9hJOZEEZa6p9hJqLC7El-w
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgwUcEpm8u6ZW3uOHXx4AaABAg.9hIlxxGY7t49hJsB2PWx C4
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgyvDj6NWT1Gxyy2JyR4AaABAg.9hIKlNPeqDn9hJskm92n p6
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=Ugwy7qx_kG9iUmMVO_F4AaABAg.9hI2IGUdmTW9hJuyaQaw qx
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgxesLhWNr_zNP0GUdh4AaABAg.9hI1CQJMLLo9hJwTB9Jl ob
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgyyQWYVP1OnCqavb-x4AaABAg
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgwJKKmExZ1FdZVDJf54AaABAg
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=Ugz_p0kVGrLntPtYzCt4AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA




    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgxesLhWNr_zNP0GUdh4AaABAg.9hI1CQJMLLo9hWn2pGBe SS
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgzkRujoMw9PblmXDQ14AaABAg.9hJRnEjxQrd9hJoCjomN I2
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgzPZbG7OvUkh35nXDd4AaABAg.9hJOZEEZa6p9hJqLC7El-w
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgwUcEpm8u6ZW3uOHXx4AaABAg.9hIlxxGY7t49hJsB2PWx C4
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgyvDj6NWT1Gxyy2JyR4AaABAg.9hIKlNPeqDn9hJskm92n p6
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=Ugwy7qx_kG9iUmMVO_F4AaABAg.9hI2IGUdmTW9hJuyaQaw qx
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgxesLhWNr_zNP0GUdh4AaABAg.9hI1CQJMLLo9hJwTB9Jl ob
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgyyQWYVP1OnCqavb-x4AaABAg
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=UgwJKKmExZ1FdZVDJf54AaABAg
    https://www.youtube.com/watch?v=pkhazgI3LAo&lc=Ugz_p0kVGrLntPtYzCt4AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  4. #44
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10
    Test runs from code [Code]Sub TestyCalls() ' http://www.excelfox.com/forum/showthread.php/2277-Vba-button-Comparison-data-between-two-file-or-two-tabs?p=10741#post10741
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=tzbKqTRuRzU&lc=UgyYW2WZ2DvSrzUKnJ14AaABAg
    https://www.youtube.com/watch?v=UywjKEMjSp0&lc=UgxIySxHPqM1RxtVqoR4AaABAg.9edGvmwOLq99eekDyfS0 CD
    https://www.youtube.com/watch?v=UywjKEMjSp0&lc=UgxIySxHPqM1RxtVqoR4AaABAg.9edGvmwOLq99eevG7txd 2c
    https://www.youtube.com/watch?v=SIDLFRkUEIo&lc=UgzTF5vvB67Zbfs9qvx4AaABAg
    https://www.youtube.com/watch?v=9P6r7DLS77Q&lc=UgzytUUVRyw9U55-6M54AaABAg
    https://www.youtube.com/watch?v=9P6r7DLS77Q&lc=UgzCoa6tOVIBxRDDDbN4AaABAg
    https://www.youtube.com/watch?v=9P6r7DLS77Q&lc=UgyriWOelbVnw4FHWT54AaABAg.9dPo-OdLmZ09dc21kigjmr
    https://www.youtube.com/watch?v=363wd2EtQZ0&lc=UgzDQfo5rJqyVwvv2r54AaABAg
    https://www.youtube.com/watch?v=363wd2EtQZ0&lc=UgzHTSka7YppBdmUooV4AaABAg.9cXui6zzkz09cZttH_-2Gf
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA





    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgxUbeYSvsBH2Gianox4AaABAg.9VYH-07VTyW9gJV5fDAZNe
    https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgxLtKj969oiIu7zNb94AaABAg
    https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgyhQ73u0C3V4bEPhYB4AaABAg
    https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgzIElpI5OFExnUyrk14AaABAg.9fsvd9zwZii9gMUka-NbIZ
    https://www.youtube.com/watch?v=jdPeMPT98QU
    https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  5. #45
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10
    Code in support of this Post
    http://www.excelfox.com/forum/showth...0741#post10741

    Code:
    Sub TestyCalls() ' http://www.excelfox.com/forum/showthread.php/2277-Vba-button-Comparison-data-between-two-file-or-two-tabs?p=10741#post10741
    ' Call Testie(Worksheets("Sheet1"), Worksheets("Sheet2"))
     Call Testy(Worksheets("Sheet1"), Worksheets("Sheet2"))
    End Sub
    Sub Testy(Ws1 As Worksheet, Ws2 As Worksheet)
    Rem 1 Worksheet data info
    '1a capture data
    '1a(i) last data rows
    Dim lr1_1 As Long, Lr1_2 As Long, Lr2_1 As Long, Lr2_2 As Long, Lr1 As Long, lr2 As Long
     Let lr1_1 = Ws1.Cells(Rows.Count, 1).End(xlUp).row
     Let Lr1_2 = Ws1.Cells(Rows.Count, 2).End(xlUp).row: Lr2_1 = Ws2.Cells(Rows.Count, 1).End(xlUp).row: Lr2_2 = Ws2.Cells(Rows.Count, 2).End(xlUp).row
        If lr1_1 > Lr1_2 Then
         Let Lr1 = lr1_1
        Else
         Let Lr1 = Lr1_2
        End If
     Let lr2 = Lr2_2: If Lr2_1 > Lr2_2 Then Let lr2 = Lr2_1
    '1a(ii) capture data into arrays in one go
    Dim arrSht1() As Variant, arrSht2() As Variant
     Let arrSht1() = Ws1.Range("A1:B" & Lr1 & "").Value
     Let arrSht2() = Ws2.Range("A1:B" & lr2 & "").Value
    Rem 2 arrays for check and output
    Dim arrSht1b() As String, arrOut() As String, arrSht1Chk() As String, arrSht2Chk() As String
    '2a size arrays to that of sheet 2 data
    ' ReDim arrSht1b(1 To UBound(arrSht2(), 1), 1 To UBound(arrSht2(), 2))
     ReDim arrOut(1 To UBound(arrSht2(), 1), 1 To UBound(arrSht2(), 2))
     ReDim arrSht1Chk(1 To UBound(arrSht1(), 1)): ReDim arrSht2Chk(1 To UBound(arrSht2(), 1)) ' Arrays for concatenated data
    '2b make check arrays                                                                                                                                                                       fill modified sheet 1 array, arrSht1b() , initially with sheet 1 data
    Dim Cnt As Long
        For Cnt = 1 To UBound(arrSht1(), 1) Step 1
    '     Let arrSht1b(Cnt, 1) = arrSht1(Cnt, 1): Let arrSht1b(Cnt, 2) = arrSht1(Cnt, 2)
         Let arrSht1Chk(Cnt) = arrSht1(Cnt, 1) & "|" & arrSht1(Cnt, 2)
        Next Cnt
        For Cnt = 1 To UBound(arrSht2(), 1) Step 1
         Let arrSht2Chk(Cnt) = arrSht2(Cnt, 1) & "|" & arrSht2(Cnt, 2)
        Next Cnt
    '2c make contents of array for output initially all dat from Sheet2
        For Cnt = 1 To UBound(arrSht2(), 1) Step 1
         Let arrOut(Cnt, 1) = CStr(arrSht2(Cnt, 1)): arrOut(Cnt, 2) = CStr(arrSht2(Cnt, 2))
        Next Cnt
    Rem 3 main loop   ' == Start Main loop ================
        For Cnt = 1 To UBound(arrSht1(), 1) Step 1 ' Counting at each row of Sheet2
        Dim MtchRes As Variant
         Let MtchRes = Application.Match(arrSht1Chk(Cnt), arrSht2Chk(), 0)
        '3a action whilst match is found --Inner Loop------
            Do While Not IsError(MtchRes) ' The 3a Loop
            Dim DupyCnt As Long: Let DupyCnt = DupyCnt + 1
                If DupyCnt > 1 Then
                 Let arrOut(MtchRes, 1) = "Dup " & DupyCnt & " of " & arrOut(MtchRes, 1): arrOut(MtchRes, 2) = "Dup " & DupyCnt & " of " & arrOut(MtchRes, 2)
                Else
                 Let arrOut(MtchRes, 1) = "": arrOut(MtchRes, 2) = "" ' remove the found data from array for output so that next line can look again for a possible duplicate
                End If
                 Let arrSht2Chk(MtchRes) = "" ' remove entry in check array so that next line can look for possible duplicate
             Let MtchRes = Application.Match(arrSht1Chk(Cnt), arrSht2Chk(), 0)
            Loop ' ----------------------------------------
         Let DupyCnt = 0 ' reset the Duplicated data count for next row of data in Sheet1
        Next Cnt ' ========= End main loop ================= effectively we go to next row of data in Sheet1 with this line
    
    Rem 5 Output in new file For testing purposes, I give the output in a third worksheet, Tabelle3
    Dim Ws3 As Worksheet: Set Ws3 = ThisWorkbook.Worksheets("Tabelle3")
     Ws3.Cells.ClearContents
     Let Ws3.Range("A1:B1").Value = "Sheet1": Ws3.Range("C1:D1").Value = "Test Output": Ws3.Range("E1:F1").Value = "Sheet2"
     Let Ws3.Range("A2").Resize(UBound(arrSht1(), 1), UBound(arrSht1(), 2)).Value = arrSht1()
     Let Ws3.Range("C2").Resize(UBound(arrOut(), 1), UBound(arrOut(), 2)).Value = arrOut()
     Let Ws3.Range("E2").Resize(UBound(arrSht2(), 1), UBound(arrSht2(), 2)).Value = arrSht2()
     Ws3.Columns.AutoFit
    Rem 6 MsgBox output
    ' MsgBox Prompt:="Inserted lines is   " & AdedRows & vbCrLf & "Changed cells is  " & DifCnt
    End Sub
    Attached Files Attached Files
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  6. #46
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10
    Code in support of this Post
    http://www.excelfox.com/forum/showth...0745#post10745

    Code:
    Option Explicit
    Sub TestyCalls() ' http://www.excelfox.com/forum/showth...0741#post10741
    ' Call Testie(Worksheets("Sheet1"), Worksheets("Sheet2"))
     Call Testy(Worksheets("Sheet1"), Worksheets("Sheet2"))
    End Sub
    Sub Testy(Ws1 As Worksheet, Ws2 As Worksheet)
    Rem 1 Worksheet data info
    '1a capture data
    '1a(i) last data rows
    Dim lr1_1 As Long, Lr1_2 As Long, Lr2_1 As Long, Lr2_2 As Long, Lr1 As Long, lr2 As Long
     Let lr1_1 = Ws1.Cells(Rows.Count, 1).End(xlUp).row
     Let Lr1_2 = Ws1.Cells(Rows.Count, 2).End(xlUp).row: Lr2_1 = Ws2.Cells(Rows.Count, 1).End(xlUp).row: Lr2_2 = Ws2.Cells(Rows.Count, 2).End(xlUp).row
        If lr1_1 > Lr1_2 Then
         Let Lr1 = lr1_1
        Else
         Let Lr1 = Lr1_2
        End If
     Let lr2 = Lr2_2: If Lr2_1 > Lr2_2 Then Let lr2 = Lr2_1
    '1a(ii) capture data into arrays in one go
    Dim arrSht1() As Variant, arrSht2() As Variant
     Let arrSht1() = Ws1.Range("A1:B" & Lr1 & "").Value
     Let arrSht2() = Ws2.Range("A1:B" & lr2 & "").Value
    Rem 2 arrays for check and output
    Dim arrSht1b() As String, arrOut() As String, arrSht1Chk() As String, arrSht2Chk() As String, arrSht2ChkKopie() As String
    '2a size arrays to that of sheet 2 data
    ' ReDim arrSht1b(1 To UBound(arrSht2(), 1), 1 To UBound(arrSht2(), 2))
     ReDim arrOut(1 To UBound(arrSht2(), 1), 1 To UBound(arrSht2(), 2))
     ReDim arrSht1Chk(1 To UBound(arrSht1(), 1))
     ReDim arrSht2Chk(1 To UBound(arrSht2(), 1))
     ReDim arrSht2ChkKopie(1 To UBound(arrSht2(), 1))
    '2b make check arrays                                                                                                                                                                       fill modified sheet 1 array, arrSht1b() , initially with sheet 1 data
    Dim Cnt As Long
        For Cnt = 1 To UBound(arrSht1(), 1) Step 1
    '     Let arrSht1b(Cnt, 1) = arrSht1(Cnt, 1): Let arrSht1b(Cnt, 2) = arrSht1(Cnt, 2)
         Let arrSht1Chk(Cnt) = arrSht1(Cnt, 1) & "|" & arrSht1(Cnt, 2)
        Next Cnt
        For Cnt = 1 To UBound(arrSht2(), 1) Step 1
         Let arrSht2Chk(Cnt) = arrSht2(Cnt, 1) & "|" & arrSht2(Cnt, 2)
        Next Cnt
     Let arrSht2ChkKopie() = arrSht2Chk() ' Arrays of same size and type can be assiigned too eachother
    '2c make contents of array for output initially all dat from Sheet2
        For Cnt = 1 To UBound(arrSht2(), 1) Step 1
         Let arrOut(Cnt, 1) = CStr(arrSht2(Cnt, 1)): arrOut(Cnt, 2) = CStr(arrSht2(Cnt, 2))
        Next Cnt
    Rem 3 main loop   ' == Start Main loop ================
        For Cnt = 1 To UBound(arrSht1(), 1) Step 1 ' Counting at each row of Sheet2
        Dim MtchRes As Variant
         Let MtchRes = Application.Match(arrSht1Chk(Cnt), arrSht2Chk(), 0)
    '        If IsError(MtchRes) Then ' case data is missing Sheet2 ( deleted ) ' This straight forward modification to the existing code will not work. This is because the code modifies the check array , arrSht2Chk() , when  checking for the data from sheet1 in sheet2
    '         Let arrOut(Cnt, 1) = "Missing: " & arrSht1(Cnt, 1): arrOut(Cnt, 2) = "Missing: " & arrSht1(Cnt, 2)
    '        Else:
            '3a(ii) action whilst match is found --Inner Loop------
                Do While Not IsError(MtchRes) ' The 3a Loop
                Dim DupyCnt As Long: Let DupyCnt = DupyCnt + 1
                    If DupyCnt > 1 Then
                     Let arrOut(MtchRes, 1) = "Dup " & DupyCnt & " of " & arrOut(MtchRes, 1): arrOut(MtchRes, 2) = "Dup " & DupyCnt & " of " & arrOut(MtchRes, 2)
                    Else
                     Let arrOut(MtchRes, 1) = "": arrOut(MtchRes, 2) = "" ' remove the found data from array for output so that next line can look again for a possible duplicate
                    End If
                     Let arrSht2Chk(MtchRes) = "" ' remove entry in check array so that next line can look for possible duplicate
                 Let MtchRes = Application.Match(arrSht1Chk(Cnt), arrSht2Chk(), 0)
                Loop ' ----------------------------------------
    '        End If '
         Let DupyCnt = 0 ' reset the Duplicated data count for next row of data in Sheet1
        Next Cnt ' ========= End Main loop ================= effectively we go to next row of data in Sheet1 with this line
    Rem 3b Second Loop   ' ##### Start Second  loop #####
        For Cnt = 1 To UBound(arrSht1(), 1) Step 1 ' Counting at each row of Sheet2
        'Dim MtchRes As Variant
         Let MtchRes = Application.Match(arrSht1Chk(Cnt), arrSht2ChkKopie, 0)
            If IsError(MtchRes) Then ' case data is missing Sheet2 ( deleted )
             Let arrOut(Cnt, 1) = "Missing: " & arrSht1(Cnt, 1): arrOut(Cnt, 2) = "Missing: " & arrSht1(Cnt, 2)
            Else
            End If '
         Let DupyCnt = 0 ' reset the Duplicated data count for next row of data in Sheet1
        Next Cnt ' ##### End Second Loop #################       effectively we go to next row of data in Sheet1 with this line
    
    
    Rem 5 Output in new file For testing purposes, I give the output in a third worksheet, Tabelle3
    Dim Ws3 As Worksheet: Set Ws3 = ThisWorkbook.Worksheets("Tabelle3")
     Ws3.Cells.ClearContents
     Let Ws3.Range("A1:B1").Value = "Sheet1": Ws3.Range("C1:D1").Value = "Test Output": Ws3.Range("E1:F1").Value = "Sheet2"
     Let Ws3.Range("A2").Resize(UBound(arrSht1(), 1), UBound(arrSht1(), 2)).Value = arrSht1()
     Let Ws3.Range("C2").Resize(UBound(arrOut(), 1), UBound(arrOut(), 2)).Value = arrOut()
     Let Ws3.Range("E2").Resize(UBound(arrSht2(), 1), UBound(arrSht2(), 2)).Value = arrSht2()
     Ws3.Columns.AutoFit
    Rem 6 MsgBox output
    ' MsgBox Prompt:="Inserted lines is   " & AdedRows & vbCrLf & "Changed cells is  " & DifCnt
    End Sub

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgyG714V_k7odQMrTz14AaABAg.9h740K6COOA9iHOYYpaA bC
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgxuL6YCUckeUIh9hoh4AaABAg
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwGTEyefOX7msIh1wZ4AaABAg.9h4sd6Vs4qE9h7G-bVm8_-
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=Ugw3nF0C04AGt73H1BB4AaABAg.9h6VhNCM-DZ9h7EqbG23kg
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwGTEyefOX7msIh1wZ4AaABAg.9h4sd6Vs4qE9h7KvJXmK 8o
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=Ugw3nF0C04AGt73H1BB4AaABAg.9h6VhNCM-DZ9h7E1gwg4Aq
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgywFtBEpkHDuK55r214AaABAg
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h79hNGvJ bu
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h79YAfa2 4T
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h79M1SYH 1E
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h78SxhXT nR
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Attached Files Attached Files
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  7. #47
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10
    Code in support of this Post
    http://www.excelfox.com/forum/showth...0745#post10745




    Using Excel 2007 32 bit
    Row\Col
    A
    B
    C
    D
    E
    F
    1
    Sheet1 Sheet1 Test Output Test Output Sheet2 Sheet2
    2
    Customer Assembly Customer Assembly
    3
    Nu Torque
    13456
    Nu Torque
    13456
    4
    Blu Origin Spaceship Alaska
    789
    5
    Jet Blue21 ABC Excel123 HiThai Excel123 HiThai
    6
    Alaska
    789
    Blu Origin Spaceship
    7
    Toyota Supra Missing: Toyota Missing: Supra Emirate ABC12345
    8
    Emirate ABC12345 Jet Blue21 ABC
    9
    Worksheet: Tabelle3


    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgwplzlpYpmRqjGZem14AaABAg.9hrvbYRwXvg9ht4b7z00 X0
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgyOGlCElBSbfPIzerF4AaABAg.9hrehNPPnBu9ht4us7Tt Pr
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgwHjKXf3ELkU4u4j254AaABAg.9hr503K8PDg9ht5mfLcg pR
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugw1-OyZiDDxCHM2Rmp4AaABAg.9hqzs_MlQu-9ht5xNvQueN
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg.9htChVuaX9W9htG01cKBzX
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugw6UrV69zpeKvLOeOV4AaABAg.9ht16tzryC49htJ6TpIO XR
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgwMKwGZpDjv7vi7pCx4AaABAg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugw6UrV69zpeKvLOeOV4AaABAg.9ht16tzryC49htOKs4jh 3M
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgxVW-am20rQ5GFuJ9F4AaABAg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugygb0YiLOI7fG1zQSx4AaABAg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugygb0YiLOI7fG1zQSx4AaABAg.9htWqRrSIfP9i-fyT84gqd
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugygb0YiLOI7fG1zQSx4AaABAg.9htWqRrSIfP9i-kIDl-3C9
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg.9htChVuaX9W9i57J9GEOUB
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg.9htChVuaX9W9i58MGeM8Lg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg.9htChVuaX9W9i59prk5atY
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgwaWs6XDXdQybNb8tZ4AaABAg.9i5yTldIQBn9i7NB1gjy Bk
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgxV9eNHvztLfFBGsvZ4AaABAg.9i5jEuidRs99i7NUtNNy 1v
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugx2zSXUtmLBSDoNWph4AaABAg.9i3IA0y4fqp9i7NySrZa md
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9i7Qs8kxE qH
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9i7TqGQYq Tz
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9iAJSNws8 Zz
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9iAJvZ6km lx
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9iAK0g1dU 7i
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9iAKCDqNm nF
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9iAKHVSTG Hy
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9iAKSBKPc J6
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9iAKgL6lr cT
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9iAKlts8h KZ
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9iAKrX7UP P0
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg.9hwsCHaKX6A9iAL5MSjW pA
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  8. #48
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10
    Results in support of answer to this post
    http://www.excelfox.com/forum/showth...0749#post10749
    ( note a typo in your data for row 9 ( correspondingly output row 10 in these screenshots) : Angle is not Angel . hence this is taken by my code as Missing data row )

    Using Excel 2007 32 bit
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    1
    Original Original Original Original Original Original Test Output Test Output Test Output Test Output Test Output NEW NEW NEW NEW NEW NEW
    2
    Assembly #: Assembly Name: Assembly Name: Assembly #: Assembly Name:
    3
    Qty Per Ref/Designator Description Customer PN Internal PN Manufacture PN Customer PN Internal PN Manufacture PN Qty Per Ref/Designator Description Customer PN Internal PN Manufacture PN
    4
    1
    Nu Torque
    13456
    456
    456
    13456 456 456
    1
    Nu Torque
    13456
    456
    456
    5
    1
    Blu Origin Spaceship
    457
    457
    Spaceship 457 457
    1
    Blu Origin Spaceship
    457
    457
    6
    2
    Jet Blue21 ABC
    458
    458
    ABC 458 458
    2
    Jet Blue21 ABC
    458
    458
    7
    3
    EXCELL123
    123
    ABC ABC MISSING: 3 MISSING: EXCELL123 MISSING: 123 MISSING: ABC MISSING: ABC
    3
    Alaska
    789
    459
    459
    8
    3
    Toyota Supra
    460
    460
    Supra 460 460
    3
    Toyota Supra
    460
    460
    9
    2
    Emirate ABC12345
    461
    461
    ABC12345 461 461
    2
    Emirate ABC12345
    461
    461
    10
    1
    Angel ABC12346
    462
    462
    MISSING: 1 MISSING: Angel MISSING: ABC12346 MISSING: 462 MISSING: 462
    1
    Angle ABC12346
    462
    462
    Worksheet: Result



    Using Excel 2007 32 bit
    Original Original Original Original Original Original Test Output Test Output Test Output Test Output Test Output NEW NEW NEW NEW NEW NEW
    Assembly #: Assembly Name: Assembly Name: Assembly #: Assembly Name:
    Qty Per Ref/Designator Description Customer PN Internal PN Manufacture PN Customer PN Internal PN Manufacture PN Qty Per Ref/Designator Description Customer PN Internal PN Manufacture PN
    1
    Nu Torque
    13456
    456
    456
    13456 456 456
    1
    Nu Torque
    13456
    456
    456
    1
    Blu Origin Spaceship
    457
    457
    Spaceship 457 457
    1
    Blu Origin Spaceship
    457
    457
    2
    Jet Blue21 ABC
    458
    458
    ABC 458 458
    2
    Jet Blue21 ABC
    458
    458
    3
    EXCELL123
    123
    ABC ABC MISSING: 3 MISSING: EXCELL123 MISSING: 123 MISSING: ABC MISSING: ABC
    3
    Alaska
    789
    459
    459
    3
    Toyota Supra
    460
    460
    Supra 460 460
    3
    Toyota Supra
    460
    460
    2
    Emirate ABC12345
    461
    461
    ABC12345 461 461
    2
    Emirate ABC12345
    461
    461
    1
    Angel ABC12346
    462
    462
    MISSING: 1 MISSING: Angel MISSING: ABC12346 MISSING: 462 MISSING: 462
    1
    Angle ABC12346
    462
    462
    Worksheet: Result
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  9. #49
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10
    Code corresponding to last post, in support of answer to this post
    http://www.excelfox.com/forum/showth...0749#post10749


    Code:
    Sub TestyCalls() ' http://www.excelfox.com/forum/showthread.php/2277-Vba-button-Comparison-data-between-two-file-or-two-tabs?p=10741#post10741
    ' Call Testie(Worksheets("Original"), Worksheets("NEW"))
    ' Call Testy(Worksheets("Original"), Worksheets("NEW"))
     Call Testies(Worksheets("Original"), Worksheets("NEW"))
    End Sub
    Sub Testies(Ws1 As Worksheet, Ws2 As Worksheet)
    Rem 1 Worksheet data info
    '1a capture data
    '1a(i) last data rows
    Dim lr1_1 As Long, Lr1_2 As Long, Lr2_1 As Long, Lr2_2 As Long, Lr1 As Long, lr2 As Long
     Let lr1_1 = Ws1.Cells(Rows.Count, 1).End(xlUp).row
     Let Lr1_2 = Ws1.Cells(Rows.Count, 2).End(xlUp).row: Lr2_1 = Ws2.Cells(Rows.Count, 1).End(xlUp).row: Lr2_2 = Ws2.Cells(Rows.Count, 2).End(xlUp).row
        If lr1_1 > Lr1_2 Then
         Let Lr1 = lr1_1
        Else
         Let Lr1 = Lr1_2
        End If
     Let lr2 = Lr2_2: If Lr2_1 > Lr2_2 Then Let lr2 = Lr2_1
    '1a(ii) capture data into arrays in one go
    Dim arrSht1() As Variant, arrSht2() As Variant
     Let arrSht1() = Ws1.Range("B1:G" & Lr1 & "").Value
     Let arrSht2() = Ws2.Range("B1:G" & Lr1 & "").Value
    Rem 2 arrays for check and output
    Dim arrSht1b() As String, arrOut() As String, arrSht1Chk() As String, arrSht2Chk() As String, arrSht2ChkKopie() As String
    '2a size arrays to that of sheet 2 data
    ' ReDim arrSht1b(1 To UBound(arrSht2(), 1), 1 To UBound(arrSht2(), 2))
     ReDim arrOut(1 To UBound(arrSht2(), 1), 1 To UBound(arrSht2(), 2) - 1) ' -1 as one column , D is not required
     ReDim arrSht1Chk(1 To UBound(arrSht1(), 1))
     ReDim arrSht2Chk(1 To UBound(arrSht2(), 1))
     ReDim arrSht2ChkKopie(1 To UBound(arrSht2(), 1))
    '2b make check arrays                                                                                                                                                                       fill modified sheet 1 array, arrSht1b() , initially with sheet 1 data
    Dim Cnt As Long
        For Cnt = 1 To UBound(arrSht1(), 1) Step 1
    '     Let arrSht1b(Cnt, 1) = arrSht1(Cnt, 1): Let arrSht1b(Cnt, 2) = arrSht1(Cnt, 2)
    '     Let arrSht1Chk(Cnt) = arrSht1(Cnt, 1) & "|" & arrSht1(Cnt, 2)
         Let arrSht1Chk(Cnt) = arrSht1(Cnt, 1) & "|" & arrSht1(Cnt, 2) & "|" & arrSht1(Cnt, 4) & "|" & arrSht1(Cnt, 5) & "|" & arrSht1(Cnt, 6)
        Next Cnt
        For Cnt = 1 To UBound(arrSht2(), 1) Step 1
    '     Let arrSht2Chk(Cnt) = arrSht2(Cnt, 1) & "|" & arrSht2(Cnt, 2)
          Let arrSht2Chk(Cnt) = arrSht2(Cnt, 1) & "|" & arrSht2(Cnt, 2) & "|" & arrSht2(Cnt, 4) & "|" & arrSht2(Cnt, 5) & "|" & arrSht2(Cnt, 6)
        Next Cnt
     Let arrSht2ChkKopie() = arrSht2Chk() ' Arrays of same size and type can be assiigned too eachother
    '2c make contents of array for output initially all dat from NEW
        For Cnt = 1 To UBound(arrSht2(), 1) Step 1
         Let arrOut(Cnt, 1) = CStr(arrSht2(Cnt, 1)): arrOut(Cnt, 2) = CStr(arrSht2(Cnt, 2)): arrOut(Cnt, 3) = CStr(arrSht2(Cnt, 4)):: arrOut(Cnt, 4) = CStr(arrSht2(Cnt, 5)):: arrOut(Cnt, 5) = CStr(arrSht2(Cnt, 6))
        Next Cnt
    Rem 3 main loop   ' == Start Main loop ================
        For Cnt = 1 To UBound(arrSht1(), 1) Step 1 ' Counting at each row of NEW
        Dim MtchRes As Variant
         Let MtchRes = Application.Match(arrSht1Chk(Cnt), arrSht2Chk(), 0)
    '        If IsError(MtchRes) Then ' case data is MISSING: NEW ( MISSING: ) ' This straight forward modification to the existing code will not work. This is because the code modifies the check array , arrSht2Chk() , when  checking for the data from Original in NEW
    '         Let arrOut(Cnt, 1) = "Missing: " & arrSht1(Cnt, 1): arrOut(Cnt, 2) = "MISSING:: " & arrSht1(Cnt, 2)
    '        Else:
            '3a(ii) action whilst match is found --Inner Loop------
                Do While Not IsError(MtchRes) ' The 3a Loop
                Dim DupyCnt As Long: Let DupyCnt = DupyCnt + 1
                    If DupyCnt > 1 Then
                     Let arrOut(MtchRes, 1) = "Dup " & DupyCnt & " of " & arrOut(MtchRes, 1): arrOut(MtchRes, 2) = "Dup " & DupyCnt & " of " & arrOut(MtchRes, 2)
                    Else
                     Let arrOut(MtchRes, 1) = "": arrOut(MtchRes, 2) = "" ' remove the found data from array for output so that next line can look again for a possible duplicate
                    End If
                     Let arrSht2Chk(MtchRes) = "" ' remove entry in check array so that next line can look for possible duplicate
                 Let MtchRes = Application.Match(arrSht1Chk(Cnt), arrSht2Chk(), 0)
                Loop ' ----------------------------------------
    '        End If '
         Let DupyCnt = 0 ' reset the Duplicated data count for next row of data in Original
        Next Cnt ' ========= End Main loop ================= effectively we go to next row of data in Original with this line
    Rem 3b Second Loop   ' ##### Start Second  loop #####
        For Cnt = 1 To UBound(arrSht1(), 1) Step 1 ' Counting at each row of NEW
        'Dim MtchRes As Variant
         Let MtchRes = Application.Match(arrSht1Chk(Cnt), arrSht2ChkKopie, 0)
            If IsError(MtchRes) Then ' case data is missing NEW ( MISSING: )
             Let arrOut(Cnt, 1) = "MISSING: " & arrSht1(Cnt, 1): arrOut(Cnt, 2) = "MISSING: " & arrSht1(Cnt, 2): arrOut(Cnt, 3) = "MISSING: " & arrSht1(Cnt, 4): arrOut(Cnt, 4) = "MISSING: " & arrSht1(Cnt, 5): arrOut(Cnt, 5) = "MISSING: " & arrSht1(Cnt, 6)
            Else
            End If '
         Let DupyCnt = 0 ' reset the Duplicated data count for next row of data in Original
        Next Cnt ' ##### End Second Loop #################       effectively we go to next row of data in Original with this line
    
    
    Rem 5 Output in new file For testing purposes, I give the output in a third worksheet, Tabelle3
    Dim Ws3 As Worksheet: Set Ws3 = ThisWorkbook.Worksheets("Result")
     Ws3.Cells.ClearContents
     Let Ws3.Range("A1:F1").Value = "Original": Ws3.Range("G1:K1").Value = "Test Output": Ws3.Range("L1:Q1").Value = "NEW"
     Let Ws3.Range("A2").Resize(UBound(arrSht1(), 1), UBound(arrSht1(), 2)).Value = arrSht1()
     Let Ws3.Range("G2").Resize(UBound(arrOut(), 1), UBound(arrOut(), 2)).Value = arrOut()
     Let Ws3.Range("L2").Resize(UBound(arrSht2(), 1), UBound(arrSht2(), 2)).Value = arrSht2()
     Ws3.Columns.AutoFit
    Rem 6 MsgBox output
    ' MsgBox Prompt:="Inserted lines is   " & AdedRows & vbCrLf & "Changed cells is  " & DifCnt
    End Sub

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgyG714V_k7odQMrTz14AaABAg.9h740K6COOA9iHOYYpaA bC
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgxuL6YCUckeUIh9hoh4AaABAg
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwGTEyefOX7msIh1wZ4AaABAg.9h4sd6Vs4qE9h7G-bVm8_-
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=Ugw3nF0C04AGt73H1BB4AaABAg.9h6VhNCM-DZ9h7EqbG23kg
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwGTEyefOX7msIh1wZ4AaABAg.9h4sd6Vs4qE9h7KvJXmK 8o
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=Ugw3nF0C04AGt73H1BB4AaABAg.9h6VhNCM-DZ9h7E1gwg4Aq
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgywFtBEpkHDuK55r214AaABAg
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h79hNGvJ bu
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h79YAfa2 4T
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h79M1SYH 1E
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h78SxhXT nR
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Attached Files Attached Files
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  10. #50
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10
    Suggested test data to answer this post: http://www.excelfox.com/forum/showth...0754#post10754

    Using Excel 2007 32 bit
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    1
    Customer: Assembly #: Assembly Name:
    2
    # Qty Per Ref/Designator Description Customer PN Internal PN Manufacture PN
    3
    1
    1
    Nu Torque
    13456
    456
    456
    4
    2
    1
    Blu Origin
    Spaceship
    457
    457
    5
    3
    2
    Jet Blue21
    ABC
    458
    458
    6
    4
    3
    EXCELL123
    123
    ABC
    ABC
    7
    5
    3
    Toyota
    Supra
    460
    460
    8
    6
    2
    Emirate
    ABC12345
    461
    461
    9
    7
    1
    Angel
    ABC12346
    462
    462
    Worksheet: Original


    Using Excel 2007 32 bit
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    1
    Customer: Assembly #: Assembly Name:
    2
    # Qty Per Ref/Designator Description Customer PN Internal PN Manufacture PN
    3
    1
    1
    Nu Torque
    13456
    456
    456
    4
    2
    1
    Blu Origin
    Spaceship
    457
    457
    5
    3
    2
    Jet Blue23
    ABC
    DEF
    DEF
    6
    4
    3
    EXCELL123
    123
    ABC
    ABC
    7
    5
    3
    Toyota
    Supra
    460
    460
    8
    6
    2
    Emirate
    ABC12345
    461
    461
    9
    3
    2
    Jet Blue21
    ABC
    458
    458
    Worksheet: NEW


    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgyG714V_k7odQMrTz14AaABAg.9h740K6COOA9iHOYYpaA bC
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgxuL6YCUckeUIh9hoh4AaABAg
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwGTEyefOX7msIh1wZ4AaABAg.9h4sd6Vs4qE9h7G-bVm8_-
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=Ugw3nF0C04AGt73H1BB4AaABAg.9h6VhNCM-DZ9h7EqbG23kg
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwGTEyefOX7msIh1wZ4AaABAg.9h4sd6Vs4qE9h7KvJXmK 8o
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=Ugw3nF0C04AGt73H1BB4AaABAg.9h6VhNCM-DZ9h7E1gwg4Aq
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgywFtBEpkHDuK55r214AaABAg
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h79hNGvJ bu
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h79YAfa2 4T
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h79M1SYH 1E
    https://www.youtube.com/watch?v=2oT4qrHmDMY&lc=UgwviLabd7r_3KpP6wh4AaABAg.9h5lFRmix1R9h78SxhXT nR
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

Similar Threads

  1. Replies: 185
    Last Post: 05-22-2024, 10:02 PM
  2. Replies: 603
    Last Post: 05-20-2024, 03:31 PM
  3. Replies: 293
    Last Post: 09-24-2020, 01:53 AM
  4. Appendix Thread. Diet Protokol Coding Adaptions
    By DocAElstein in forum Test Area
    Replies: 6
    Last Post: 09-05-2019, 10:45 AM

Posting Permissions

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