View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default If username not match then print out report

Sub ABCE()
Dim rng as Range, rng1 as Range, cell as Range
Dim res as Variant
set rng = Workbooks("LargerList.xls").Worksheets("Data").Ran ge("F1:F500"
set rng1 = Workbooks("SmallerList.xls").Worksheets("Data").Ra nge("F1:F50"
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
rng.Parent.Printout
rng.Parent.Rows.Hidden = False
End Sub



--
Regards,
Tom Ogilvy

"Lillian" wrote in message
...
Tom:

Both xls file username is on column F, how do I use your code? what means

by
(cell,rng1,0)?

Thanks.

Lillian

"Tom Ogilvy" wrote:

Dim rng as Range, rng1 as Range, cell as Range
Dim res as Variant
set rng = Workbooks("LargerList.xls").Worksheets("Data").Ran ge("A1:A500"
set rng1 =

Workbooks("SmallerList.xls").Worksheets("Data").Ra nge("A1:A50"
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
rng.Parent.Printout
rng.Parent.Rows.Hidden = False

--
Regards,
Tom Ogilvy

"Lillian" wrote in message
...
I have two excel spread sheet and I need to match usernname on both

sheet,
one spread sheet has more record than the other, I need to print out

the
record if the username are not the same, how can write the macro for

this?



Thanks.

Lillian