ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If username not match then print out report (https://www.excelbanter.com/excel-programming/336080-if-username-not-match-then-print-out-report.html)

lillian

If username not match then print out report
 
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

Tom Ogilvy

If username not match then print out report
 
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




lillian

If username not match then print out report
 
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





Tom Ogilvy

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







Tom Ogilvy

If username not match then print out report
 
typo

Sub ABCE()
Dim rng as Range, rng1 as Range, cell as Range
Dim res as Variant
set rng = Workbooks("LargerList.xls"). _
Worksheets("Data").Range("F1:F500")
set rng1 = Workbooks("SmallerList.xls"). _
Worksheets("Data").Range("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



---------------------
(cell,rng1,0)
are the arguments to the MATCH worksheet function

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
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









All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com