View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Created another spread sheet if SSN is not match

Sub ABCF()
Dim rng as Range, rng1 as Range, cell as Range
Dim rng3 as Range
Dim res as Variant
' sheet with longer list of SSN
set rng = Worksheets("Sheet1").Range("D1:D500")
' sheet with shorter list of SSN
set rng1 = Worksheets("Sheet2").Range("D1:D50")
for each cell in rng
res = Application.Match(cell,rng1,0)
if not iserror(res) then
cell.EntireRow.Hidden = True
else
cell.Entirerow.Hidden = False
end if
Next
set rng3 = worksheets("Sheet1").columns(1).specialcells(xlVis ible)
rng3.EntireRow.copy _
Destination:=Worksheets("sheet3").Range("A1")
rng.Parent.Rows.Hidden = False
End Sub

--
Regards,
Tom Ogilvy

"Lillian" wrote in message
...
I have two excel spread sheet,on sheet1 column D has SSN,on sheet2 column

D
has SSN, I need to do the match this two sheet1 and sheet2, if both SSN

did
not match, then I need to create on sheet3, show all the different record.

How can I do that in macro?

Thanks.

Lillian