呵呵,你这个方法虽然简单,操作却不方便,这样试试,在表1设一按钮公式:
Eval("RemoveGrid("""+Substitute(ListFor(GridName,"姓名",1),"|",""") And RemoveGrid(""")+""")") And Eval("Eval(""CreateGrid(""""" +Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Eval("Substitute(""|@|#|&|$|/|"",""|"","""+Substitute(ListFor("表1","姓名",1),"|",""")+""|""+Substitute(""|@|#|&|$|/|"",""|"",""")+""")"),"|",""""",2)"",2,2) and Eval(""CreateGrid("""""),"@",""""",""""ABC"""",0,""""""+Substitute(ListFor(""表1"",""品名"",1),""|"","""""",1,"""""")+"""""",1)"") and Evalfor("""),"#",""",1,""CrossFill(2,""""表1"""",""""姓名"""",""""品名"""",""""数量"""",0,""""姓名"""",""""="""","""""),"&",""""") And RenameCol(1,""""姓名"""") And DeleteCol("""""),"$",""""",["),"/","!Cols]) And DelRow(""""") +""""",2)"",2,2)") And MsgBox("统计完毕!",1,4)