Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Report data from cell if dates match | Excel Discussion (Misc queries) | |||
Report data from cell if dates match | Excel Discussion (Misc queries) | |||
Report data from cell if dates match | Excel Discussion (Misc queries) | |||
Print Report W/Sub Report | Excel Discussion (Misc queries) | |||
How can I print the username or computername from excel? | Excel Discussion (Misc queries) |