Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Report data from cell if dates match WildWill Excel Discussion (Misc queries) 1 February 9th 09 08:57 AM
Report data from cell if dates match WildWill Excel Discussion (Misc queries) 2 February 9th 09 07:56 AM
Report data from cell if dates match WildWill Excel Discussion (Misc queries) 2 February 9th 09 07:48 AM
Print Report W/Sub Report Roger Excel Discussion (Misc queries) 0 September 6th 06 10:53 PM
How can I print the username or computername from excel? YesNo Excel Discussion (Misc queries) 0 March 9th 05 06:03 PM


All times are GMT +1. The time now is 01:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"