[color=blue]Option[/color][color=blue]Explicit[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]<o:p>[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]</o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Sub[/color]GetUnregisteredSHimplfGlified()<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'SomeInitilal Dimensioning, getting of Data[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]ws1 [color=blue]As[/color] Worksheet: [color=blue]Set[/color] ws1 =ThisWorkbook.Worksheets("CurlyAladinVBA")<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]arrIn() [color=blue]As[/color] Variant: [color=blue]Let[/color] arrIn() =ws1.Range("A1").CurrentRegion.Value<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]arrOut() [color=blue]As[/color] [color=blue]String[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]ReDim[/color]arrOut(1 [color=blue]To[/color] [color=blue]UBound[/color](arrIn(), 1), 1 [color=blue]To[/color]2)<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]r1 [color=blue]As[/color] [color=blue]Long[/color], r2 [color=blue]As[/color] [color=blue]Long[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]lr2 [color=blue]As[/color] Long: [color=blue]Let[/color] lr2 =ws1.Cells(Rows.Count, 2).End(xlUp).Row<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]arrField2() [color=blue]As[/color] Variant: [color=blue]Let[/color] arrField2()= ws1.Range("B2:B" & lr2 & "").Value<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]TempName [color=blue]As[/color] [color=blue]String[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]<o:p>[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]</o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'ObtainList for Unique names[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]lshtc [color=blue]As[/color] Long: [color=blue]Let[/color] lshtc =ws1.Columns.Count<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Let[/color] ws1.Cells(1, lshtc)= "Unique"<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]For[/color] r1 = 2 [color=blue]To[/color][color=blue]UBound[/color](arrIn(), 1) [color=blue]Step[/color] 1<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]On[/color][color=blue]Error[/color] [color=blue]Resume[/color] [color=blue]Next[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]If[/color]ws1.Cells(r1, 1) <> "" AndApplication.WorksheetFunction.Match(ws1.Cells(r1, 1), ws1.Columns(lshtc), 0) =-1234 [color=blue]Then[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] ws1.Cells(ws1.Rows.Count,lshtc).End(xlUp).Offset(1) = ws1.Cells(r1, 1)<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]End[/color] [color=blue]If[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Next[/color] r1<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]On[/color] [color=blue]Error[/color][color=blue]GoTo[/color] TheEnd<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Dim[/color] myarr() [color=blue]As[/color][color=blue]Variant[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] myarr() =Application.WorksheetFunction.Transpose(ws1.Columns(lshtc).SpecialCells(xlCellTypeConstants,xlTextValues).Value)<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] ws1.Columns(lshtc).Delete<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] <o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'Loopto put "Registered in appropriate place in Output Array[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]For[/color] r1 = 2 [color=blue]To[/color][color=blue]UBound[/color](arrIn(), 1) [color=blue]Step[/color] 1<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]If[/color]arrIn(r1, 1) <> "" [color=blue]Then[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]For[/color] r2 = 2 [color=blue]To[/color]lr2 [color=blue]Step[/color] 1<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]If[/color] arrIn(r1, 1)= arrIn(r2, 2) [color=blue]Then[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Let[/color] arrOut(r1, 1) = "Registered"<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]End[/color] [color=blue]If[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Next[/color] r2<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]End[/color] [color=blue]If[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Next[/color] r1<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]<o:p>[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]</o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'Loopto Put unregistered names in Array[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]rout [color=blue]As[/color] Long: [color=blue]Let[/color] rout = 1<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]For[/color] r1 = 2 [color=blue]To[/color][color=blue]UBound[/color](myarr) [color=blue]Step[/color] 1<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Let[/color] TempName =myarr(r1)<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]On[/color] [color=blue]Error[/color][color=blue]Resume[/color] [color=blue]Next[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]If[/color]Application.WorksheetFunction.Match(TempName, arrField2(), 0) = -1234 [color=blue]Then[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Let[/color] rout = rout + 1<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Let[/color] arrOut(rout, 2)= TempName<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]End[/color] [color=blue]If[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]On[/color] [color=blue]Error[/color][color=blue]GoTo[/color] TheEnd<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Next[/color] r1<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]<o:p>[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]</o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'Outputresuls to shaeet[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Let[/color]ws1.Range("C1").Resize(UBound(arrOut(), 1), 2).Value = arrOut()<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Let[/color]ws1.Range("A1").Resize(1, 4).Value = Array("Field1","Field2", "Registered", "Not Registered")<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]TheEnd:<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]End[color=blue]Sub[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]'<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]'<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]'<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]'<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]'<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]'<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]'<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]<o:p>[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]</o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Sub[/color]GetUnregistered() 'http://www.mrexcel.com/forum/excel-questions/857924-compare-columns-display-whats-unique-separate-column.html<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'1) Some initilal dimensioning, geting Spreadsheet data / info[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]ws1 [color=blue]As[/color] Worksheet: [color=blue]Set[/color] ws1 =ThisWorkbook.Worksheets("CurlyAladinVBA") [color=lightgreen]'Giveabreviation method, properies etc. of worksheets object obtained by typing.[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]arrIn() [color=blue]As[/color] Variant: [color=blue]Let[/color] arrIn() =ws1.Range("A1").CurrentRegion.Value [color=lightgreen]'Dynamic Arrayfor "Capture" of Spreadsheet, using the VBA allowed "oneliner" to assign an Array to values of cells in a range. So must be avariant as it sees the Range object as it is assigned a collection[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]arrOut() [color=blue]As[/color] [color=blue]String[/color] [color=lightgreen]'Thisis a non Dynamic array to have values asigned in the following loop, so we candefine it's type. Here String ic conveniant for names and numbers.[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]ReDim[/color]arrOut(1 [color=blue]To[/color] [color=blue]UBound[/color](arrIn(), 1), 1 [color=blue]To[/color]2) [color=lightgreen]'Output Array given maximuum possible size. Must use reDimas [color=blue]Dim[/color] only takes numbers, not variables[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]r1 [color=blue]As[/color] [color=blue]Long[/color], r2 [color=blue]As[/color] [color=blue]Long[/color][color=lightgreen]' Rows of Input Array[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]lr2 [color=blue]As[/color] Long: [color=blue]Let[/color] lr2 =ws1.Cells(Rows.Count, 2).End(xlUp).Row [color=lightgreen]'Apply Propertv .[color=blue]End[/color]on Range( cell ) at end of sheet in Column , this returns a new range ( lastcell with something in ) form which the Row Property returns the Row.[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] <o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'2) Loop to get Registered names[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]For[/color] r1 = 2 [color=blue]To[/color][color=blue]UBound[/color](arrIn(), 1) [color=blue]Step[/color] 1 [color=lightgreen]'Godown the "Rows" in the Inputed Array and...[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]If[/color] arrIn(r1, 1)<> "" [color=blue]Then[/color] [color=lightgreen]' check forempty cell first "column", if not...[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]For[/color] r2 = 2 [color=blue]To[/color]lr2 [color=blue]Step[/color] 1 [color=lightgreen]'foreach row look again down each just as far as the last entry in column 2[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]If[/color] arrIn(r1, 1)= arrIn(r2, 2) [color=blue]Then[/color] [color=lightgreen]'Seeif a name match is found, then if it is The person is registered so...[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Let[/color] arrOut(r1,1) = "Registered" [color=lightgreen]'put"Registered" in the outpout array in the same row that they appear in"column1"[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Else[/color] [color=lightgreen]'Thecurrent Name in column 1 is not (yet) found in column 2 so do nothing yet'(Redundant code line )[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]End[/color] [color=blue]If[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Next[/color] r2 [color=lightgreen]'Gotto next row for column 2 name[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Else[/color] [color=lightgreen]'Forcase of empty cell do nothing'( Redundant code Line )[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] End [color=blue]If[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Next[/color] r1 [color=lightgreen]'Goto next row for next column 1 name[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]<o:p>[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]</o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'3) Get a unique list of names and check uisng Match function to see if they arealso in column 2[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=lightgreen]'3a) make an Array forUnique Search values, using a Tempory column[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]lshtc [color=blue]As[/color] Long: [color=blue]Let[/color] lshtc =ws1.Columns.Count [color=lightgreen]'Number of Columns in sheet...### used ascolumn number for tempory unique column...[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Let[/color] ws1.Cells(1, lshtc)= "Unique" [color=lightgreen]'...###The last Column inn the sheet isused. (This has an advantage of not interfering with our Method for gettinglc). Here just for fun we give the array, that is to say the tempory column, aheading[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]For[/color] r1 = 2 [color=blue]To[/color][color=blue]UBound[/color](arrIn(), 1) [color=blue]Step[/color] 1 [color=lightgreen]'Goingdown all rows from just after heading inFirst sheet[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]On[/color] [color=blue]Error[/color][color=blue]Resume[/color] [color=blue]Next[/color] [color=lightgreen]''Thiserror handler is for the predicted error if no match, so below line errors inwhich case we go on at the line just after the next[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]If[/color]ws1.Cells(r1, 1) <> "" AndApplication.WorksheetFunction.Match(ws1.Cells(r1, 1), ws1.Columns(lshtc), 0) =-1234 [color=blue]Then[/color] [color=lightgreen]'provided something is there,we check to see if that value is already in our vLook Up Array by looking tosee for a match. If it is not there then, the predicted error occurs.......Thisis part of "Match On Error Pair" trick for getting Unique values.(See here http://www.excelforum.com/excel-new-users-basics/1072093-match-with-on-error-on-error-resume-next-works-on-error-goto-only-works-once-err-clear.html ). Otherwisde it does not crash as it gets aLong Number, ( the indicie going down the row, 1 , 2 , 3 or 4 etc. ) - But itwill not get -1234 ! - it accepts thogh syntaxly this as OK, - most peoplewrite 0 here.[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] ws1.Cells(ws1.Rows.Count, lshtc).[color=blue]End[/color](xlUp).Offset(1)= ws1.Cells(r1, 1) [color=lightgreen]'.....So Put it there.. The "Trick" is - if theabove Match errors as no match is found, the "Resume Next" means"[color=blue]Next[/color] line" so we come here on error and actuallydo what normally would be done after "Then" If the [color=blue]If[/color]condition was met!![/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Else[/color] [color=lightgreen]'Elsedo nothing[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] End [color=blue]If[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Next[/color] r1<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]On[/color] [color=blue]Error[/color][color=blue]GoTo[/color] TheEnd [color=lightgreen]'We no longer expecting anerror, so we switch back on the error handler for unexpected errors[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] Dim myarr() [color=blue]As[/color] [color=blue]Variant[/color][color=lightgreen]'Array for Unique search criteria. Important to get this [color=blue]Dim[/color]ensioningright. Variant must be used as below initially an object is seen...>> http://www.excelforum.com/excel-new-users-basics/1058406-range-dimensioning-range-and-value-referencing-and-referring-to-arrays.html[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] myarr() = Application.WorksheetFunction.Transpose(ws1.Columns(lshtc).SpecialCells(xlCellTypeConstants,xlTextValues).Value) [color=lightgreen]'just a complicated but nice one-linerway of getting just the values and no empty cells in the Array.XlcellTypeConstants just gives constants, the second argument is the type. HereStrings are there as the heading made sure of that - here excel guessed basedon that due to the heading string "Unique".. This could be anuntypical case where that second argument could be left out. Transpose is justto get the Array as A Row of Columns which we need rather than a Column of rowsas is in the tempory Column.[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] ws1.Columns(lshtc).Delete [color=lightgreen]'Deletethe tempory Column (Delete is usually better than Clear.. >> http://www.mrexcel.com/forum/excel-questions/787428-clear-delete-shift-%3Dxlup-let-y-%3D-y-%96-1-usedrange-rows-count-anomale.html[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=lightgreen]'---[color=blue]End[/color]of making an Array----------------------------------------[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] <o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=lightgreen]'3b)uisng match function tosee if the uniques occur in column 2[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]arrField2() [color=blue]As[/color] Variant: [color=blue]Let[/color] arrField2()= ws1.Range("B2:B" & lr2 & "").Value [color=lightgreen]'Arrayfor use in Match second "Array" Argument.[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Dim[/color]TempName [color=blue]As[/color] [color=blue]String[/color] [color=lightgreen]'Temporyname needed for unregistered search as Match Function willnot take arrayelement as firsd argument[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]Dimrout [color=blue]As[/color] Long: [color=blue]Let[/color] rout = 1 [color=lightgreen]'Rowin output Array column 2[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]For[/color] r1 = 2 [color=blue]To[/color][color=blue]UBound[/color](myarr) [color=blue]Step[/color] 1 [color=lightgreen]'[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Let[/color] TempName =myarr(r1)<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]On[/color] [color=blue]Error[/color][color=blue]Resume[/color] [color=blue]Next[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]If[/color]Application.WorksheetFunction.Match(TempName, arrField2(), 0) = -1234 [color=blue]Then[/color][color=lightgreen]'Using similar method to above to go to next line if no matchfound and Match function errors[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Let[/color] rout = rout + 1[color=lightgreen]'Increase output row to next free[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Let[/color] arrOut(rout, 2)= TempName<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]Else[/color] [color=lightgreen]'Hadno error, got a match indicie, but not -1234!!! So we have this name in theunique name lists[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] End If<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] [color=blue]On[/color] [color=blue]Error[/color][color=blue]GoTo[/color] TheEnd<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"] Next r1<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'Outputto sheet[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Let[/color]ws1.Range("C1").Resize(UBound(arrOut(), 1), 2).Value = arrOut() [color=lightgreen]'Atypical step that looks cleverer then it is, I resize first cell to a rangeincluding all reulzs I want, and then VBA lets me assign the values in a oneliner, by making the rabe values = to that Array[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=blue]Let[/color]ws1.Range("A1").Resize(1, 4).Value = Array("Field1","Field2", "Registered", "Not Registered") [color=lightgreen]'Similarto the above, resize A1 to 4 columns, 1 row, Put the headings in a Array andthen as above put Array to the cells in a simple = step[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]The[color=blue]End[/color]:<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"][color=lightgreen]'Normallyput anything here that should be done inthe case of an error[/color]<o:p></o:p>[/FONT][/COLOR]
[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][COLOR=gray][FONT="Arial"]End[color=blue]Sub[/color] [color=lightgreen]'GetUnregistered[/color]