Files
2026-02-13 22:24:27 +08:00

1 line
129 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"ID":"20250915181912-ps3j7ip","Spec":"2","Type":"NodeDocument","Properties":{"id":"20250915181912-ps3j7ip","title":"物控随笔","type":"doc","updated":"20250917093407"},"Children":[{"ID":"20250915181914-w3kyf6e","Type":"NodeParagraph","Properties":{"id":"20250915181914-w3kyf6e","updated":"20250915181914"}},{"ID":"20250915181914-tmrh106","Type":"NodeParagraph","Properties":{"id":"20250915181914-tmrh106","updated":"20250915182034"},"Children":[{"Type":"NodeText","Data":"接收客户or业务的frocest根据客户的产品需求"}]},{"ID":"20250915181914-zvvkc0s","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-zvvkc0s","updated":"20250915181914"},"Children":[{"ID":"20250915181914-see4u8n","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-see4u8n","updated":"20250915181914"},"Children":[{"ID":"20250915181914-g5y4lzy","Type":"NodeParagraph","Properties":{"id":"20250915181914-g5y4lzy","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"数据库设计思路"}]},{"ID":"20250915181914-j3z5b7m","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-j3z5b7m","updated":"20250915181914"},"Children":[{"ID":"20250915181914-su0t4je","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-su0t4je","updated":"20250915181914"},"Children":[{"ID":"20250915181914-mo5i2fp","Type":"NodeParagraph","Properties":{"id":"20250915181914-mo5i2fp","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"access数据库替代产品 LibreOffice Base待验证"}]}]},{"ID":"20250915181914-46i4or1","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-46i4or1","updated":"20250915181914"},"Children":[{"ID":"20250915181914-mhoct0b","Type":"NodeParagraph","Properties":{"id":"20250915181914-mhoct0b","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"BOM表"}]},{"ID":"20250915181914-cpcmixm","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-cpcmixm","updated":"20250915181914"},"Children":[{"ID":"20250915181914-gz4b8x6","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-gz4b8x6","updated":"20250915181914"},"Children":[{"ID":"20250915181914-sex92fe","Type":"NodeParagraph","Properties":{"id":"20250915181914-sex92fe","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeImage","Data":"span","Children":[{"Type":"NodeBang"},{"Type":"NodeOpenBracket"},{"Type":"NodeLinkText","Data":"image"},{"Type":"NodeCloseBracket"},{"Type":"NodeOpenParen"},{"Type":"NodeLinkDest","Data":"assets/image-20250910053114-vh79rzj.png"},{"Type":"NodeCloseParen"}]},{"Type":"NodeText","Data":""}]}]}]}]},{"ID":"20250915181914-70o3lz1","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-70o3lz1","updated":"20250915181914"},"Children":[{"ID":"20250915181914-7tt6sso","Type":"NodeParagraph","Properties":{"id":"20250915181914-7tt6sso","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"Forecats 该表单根据厂商动态Forecats变换"}]},{"ID":"20250915181914-pwimr2v","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-pwimr2v","updated":"20250915181914"},"Children":[{"ID":"20250915181914-d5bk52h","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-d5bk52h","updated":"20250915181914"},"Children":[{"ID":"20250915181914-trt3cd0","Type":"NodeParagraph","Properties":{"id":"20250915181914-trt3cd0","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeImage","Data":"span","Children":[{"Type":"NodeBang"},{"Type":"NodeOpenBracket"},{"Type":"NodeLinkText","Data":"image"},{"Type":"NodeCloseBracket"},{"Type":"NodeOpenParen"},{"Type":"NodeLinkDest","Data":"assets/image-20250910053241-igd19w1.png"},{"Type":"NodeCloseParen"}]},{"Type":"NodeText","Data":""}]}]}]}]}]}]}]},{"ID":"20250915181914-6huxd7r","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-6huxd7r","updated":"20250915181914"},"Children":[{"ID":"20250915181914-hu7vcdq","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-hu7vcdq","updated":"20250915181914"},"Children":[{"ID":"20250915181914-qxn4te5","Type":"NodeParagraph","Properties":{"id":"20250915181914-qxn4te5","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"数据库查询设计思路"}]},{"ID":"20250915181914-ct7hr4h","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-ct7hr4h","updated":"20250915181914"},"Children":[{"ID":"20250915181914-nqhzr1o","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-nqhzr1o","updated":"20250915181914"},"Children":[{"ID":"20250915181914-cnzcfm9","Type":"NodeParagraph","Properties":{"id":"20250915181914-cnzcfm9","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"先新建一个链接表,跑出来"}]},{"ID":"20250915181914-wxco2v0","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-wxco2v0","updated":"20250915181914"},"Children":[{"ID":"20250915181914-rtid8yu","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-rtid8yu","updated":"20250915181914"},"Children":[{"ID":"20250915181914-hc8x0gy","Type":"NodeParagraph","Properties":{"id":"20250915181914-hc8x0gy","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeImage","Data":"span","Children":[{"Type":"NodeBang"},{"Type":"NodeOpenBracket"},{"Type":"NodeLinkText","Data":"image"},{"Type":"NodeCloseBracket"},{"Type":"NodeOpenParen"},{"Type":"NodeLinkDest","Data":"assets/image-20250910055605-291ady3.png"},{"Type":"NodeCloseParen"}]},{"Type":"NodeText","Data":""}]}]},{"ID":"20250915181914-z9qwqqu","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-z9qwqqu","updated":"20250915181914"},"Children":[{"ID":"20250915181914-7o49sej","Type":"NodeParagraph","Properties":{"id":"20250915181914-7o49sej","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeImage","Data":"span","Children":[{"Type":"NodeBang"},{"Type":"NodeOpenBracket"},{"Type":"NodeLinkText","Data":"image"},{"Type":"NodeCloseBracket"},{"Type":"NodeOpenParen"},{"Type":"NodeLinkDest","Data":"assets/image-20250910055628-3rqqk5v.png"},{"Type":"NodeCloseParen"}]},{"Type":"NodeText","Data":""}]}]}]}]},{"ID":"20250915181914-nya7a5x","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-nya7a5x","updated":"20250915181914"},"Children":[{"ID":"20250915181914-nx8ohai","Type":"NodeParagraph","Properties":{"id":"20250915181914-nx8ohai","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeImage","Data":"span","Children":[{"Type":"NodeBang"},{"Type":"NodeOpenBracket"},{"Type":"NodeLinkText","Data":"image"},{"Type":"NodeCloseBracket"},{"Type":"NodeOpenParen"},{"Type":"NodeLinkDest","Data":"assets/image-20250910052947-90dbhf6.png"},{"Type":"NodeCloseParen"}]},{"Type":"NodeText","Data":""}]}]},{"ID":"20250915181914-x8b55s7","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-x8b55s7","updated":"20250915181914"},"Children":[{"ID":"20250915181914-mrkuqz6","Type":"NodeParagraph","Properties":{"id":"20250915181914-mrkuqz6","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeImage","Data":"span","Children":[{"Type":"NodeBang"},{"Type":"NodeOpenBracket"},{"Type":"NodeLinkText","Data":"image"},{"Type":"NodeCloseBracket"},{"Type":"NodeOpenParen"},{"Type":"NodeLinkDest","Data":"assets/image-20250910053022-2jcp8wz.png"},{"Type":"NodeCloseParen"}]},{"Type":"NodeText","Data":""}]}]}]}]},{"ID":"20250915181914-xy6p134","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-xy6p134","updated":"20250915181914"},"Children":[{"ID":"20250915181914-ops5msd","Type":"NodeParagraph","Properties":{"id":"20250915181914-ops5msd","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"(自己维护数据库)跑出的物料需求,由相关物料料号导出"}]}]}]},{"ID":"20250915181914-svl7ghh","Type":"NodeTable","TableAligns":[0,0,0,0,0,0,0],"Properties":{"colgroup":"||||||","id":"20250915181914-svl7ghh","updated":"20250915181914"},"Children":[{"Type":"NodeTableHead","Data":"thead","Children":[{"Type":"NodeTableRow","Data":"tr","Children":[{"Type":"NodeTableCell","Data":"th","Children":[{"Type":"NodeText","Data":"库存"}]},{"Type":"NodeTableCell","Data":"th","Children":[{"Type":"NodeText","Data":"待验"}]},{"Type":"NodeTableCell","Data":"th","Children":[{"Type":"NodeText","Data":"需求"}]},{"Type":"NodeTableCell","Data":"th","Children":[{"Type":"NodeText","Data":"PO"}]},{"Type":"NodeTableCell","Data":"th","Children":[{"Type":"NodeText","Data":"PR"}]},{"Type":"NodeTableCell","Data":"th","Children":[{"Type":"NodeText","Data":"天数"}]},{"Type":"NodeTableCell","Data":"th","Children":[{"Type":"NodeText","Data":"MOQ"}]}]}]}]},{"ID":"20250915181914-lxt55bb","Type":"NodeParagraph","Properties":{"id":"20250915181914-lxt55bb","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"MOQ 最小订货量"}]},{"ID":"20250915181914-2q3e41i","Type":"NodeParagraph","Properties":{"id":"20250915181914-2q3e41i","updated":"20250915181914"}},{"ID":"20250915181914-q0e4dry","Type":"NodeParagraph","Properties":{"id":"20250915181914-q0e4dry","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"计算"}]},{"ID":"20250915181914-gmpyal1","Type":"NodeParagraph","Properties":{"id":"20250915181914-gmpyal1","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"欠料數量 = 库存 + 待验 - 需求"}]},{"ID":"20250915181914-qxq904h","Type":"NodeParagraph","Properties":{"id":"20250915181914-qxq904h","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"BLA = 库存 + 待验+ PO +PR - 需求"}]},{"ID":"20250915181914-g75z190","Type":"NodeParagraph","Properties":{"id":"20250915181914-g75z190","updated":"20250915181914"}},{"ID":"20250915181914-jlhc6ha","Type":"NodeParagraph","Properties":{"id":"20250915181914-jlhc6ha","updated":"20250915181914"}},{"ID":"20250915181914-8mvhsk9","Type":"NodeParagraph","Properties":{"id":"20250915181914-8mvhsk9","updated":"20250915181914"}},{"ID":"20250915181914-wf8a3ac","Type":"NodeParagraph","Properties":{"id":"20250915181914-wf8a3ac","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"BLA 是什么"}]},{"ID":"20250915181914-59cog79","Type":"NodeParagraph","Properties":{"id":"20250915181914-59cog79","updated":"20250915181914"}},{"ID":"20250915181914-0akc6xx","Type":"NodeParagraph","Properties":{"id":"20250915181914-0akc6xx","updated":"20250915181914"}},{"ID":"20250915181914-191bidu","Type":"NodeParagraph","Properties":{"id":"20250915181914-191bidu","updated":"20250915181914"}},{"ID":"20250915181914-kpb8dwv","Type":"NodeParagraph","Properties":{"id":"20250915181914-kpb8dwv","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"=K3+N3-EA3"}]},{"ID":"20250915181914-mzg0nz3","Type":"NodeParagraph","Properties":{"id":"20250915181914-mzg0nz3","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"BLA + 已下的pr"}]},{"ID":"20250915181914-y8muqas","Type":"NodeParagraph","Properties":{"id":"20250915181914-y8muqas","updated":"20250915181914"}},{"ID":"20250915181914-kg3zrtp","Type":"NodeParagraph","Properties":{"id":"20250915181914-kg3zrtp","updated":"20250915181914"}},{"ID":"20250915181914-myeq1ni","Type":"NodeParagraph","Properties":{"id":"20250915181914-myeq1ni","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"收到BP"}]},{"ID":"20250915181914-xoztaer","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-xoztaer","updated":"20250915181914"},"Children":[{"ID":"20250915181914-ypi0syk","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-ypi0syk","updated":"20250915181914"},"Children":[{"ID":"20250915181914-5truj7v","Type":"NodeParagraph","Properties":{"id":"20250915181914-5truj7v","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"制定物料计划"}]},{"ID":"20250915181914-ikcytoa","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-ikcytoa","updated":"20250915181914"},"Children":[{"ID":"20250915181914-pt7u0z3","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-pt7u0z3","updated":"20250915181914"},"Children":[{"ID":"20250915181914-yqf8hdn","Type":"NodeParagraph","Properties":{"id":"20250915181914-yqf8hdn","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"交采购追厂商交期"}]},{"ID":"20250915181914-qunhkna","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-qunhkna","updated":"20250915181914"},"Children":[{"ID":"20250915181914-0zcmaze","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-0zcmaze","style":"--en-bullet-line-height: 76px;","updated":"20250915181914"},"Children":[{"ID":"20250915181914-0dyiwbj","Type":"NodeParagraph","Properties":{"id":"20250915181914-0dyiwbj","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"厂商回复or更新厂商回复给客户原因"}]}]}]}]}]}]}]},{"ID":"20250915181914-ajjfb7m","Type":"NodeParagraph","Properties":{"id":"20250915181914-ajjfb7m","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeImage","Data":"span","Children":[{"Type":"NodeBang"},{"Type":"NodeOpenBracket"},{"Type":"NodeLinkText","Data":"image"},{"Type":"NodeCloseBracket"},{"Type":"NodeOpenParen"},{"Type":"NodeLinkDest","Data":"assets/image-20250910073218-ctsgv7h.png"},{"Type":"NodeCloseParen"}]},{"Type":"NodeText","Data":""}]},{"ID":"20250915181914-7iexjbj","Type":"NodeParagraph","Properties":{"id":"20250915181914-7iexjbj","updated":"20250915181914"}},{"ID":"20250915181914-lrg5or0","Type":"NodeParagraph","Properties":{"id":"20250915181914-lrg5or0","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"vlookup 使用"}]},{"ID":"20250915181914-nah9mya","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-nah9mya","updated":"20250915181914"},"Children":[{"ID":"20250915181914-m7o1ygs","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-m7o1ygs","updated":"20250915181914"},"Children":[{"ID":"20250915181914-r2ad3u9","Type":"NodeParagraph","Properties":{"id":"20250915181914-r2ad3u9","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"参考:"},{"Type":"NodeTextMark","TextMarkType":"block-ref","TextMarkBlockRefID":"20250910161036-7r4nyax","TextMarkBlockRefSubtype":"d","TextMarkTextContent":"VLOOKUP学习使用"}]}]},{"ID":"20250915181914-0k8vn52","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-0k8vn52","updated":"20250915181914"},"Children":[{"ID":"20250915181914-i0ui3y0","Type":"NodeParagraph","Properties":{"id":"20250915181914-i0ui3y0","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeImage","Data":"span","Children":[{"Type":"NodeBang"},{"Type":"NodeOpenBracket"},{"Type":"NodeLinkText","Data":"image"},{"Type":"NodeCloseBracket"},{"Type":"NodeOpenParen"},{"Type":"NodeLinkDest","Data":"assets/image-20250910075336-1law5jz.png"},{"Type":"NodeCloseParen"}]},{"Type":"NodeText","Data":""}]}]}]},{"ID":"20250915181914-qp88xq1","Type":"NodeParagraph","Properties":{"id":"20250915181914-qp88xq1","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":""}]},{"ID":"20250915181914-jcp1q7y","Type":"NodeParagraph","Properties":{"id":"20250915181914-jcp1q7y","updated":"20250915181914"}},{"ID":"20250915181914-hp8zmtp","Type":"NodeParagraph","Properties":{"id":"20250915181914-hp8zmtp","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"SAP中的需求是怎么来的与我们收到的BPforcest有何关系"}]},{"ID":"20250915181914-6yasi28","Type":"NodeParagraph","Properties":{"id":"20250915181914-6yasi28","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeImage","Data":"span","Children":[{"Type":"NodeBang"},{"Type":"NodeOpenBracket"},{"Type":"NodeLinkText","Data":"image"},{"Type":"NodeCloseBracket"},{"Type":"NodeOpenParen"},{"Type":"NodeLinkDest","Data":"assets/image-20250910092434-ljqtovl.png"},{"Type":"NodeCloseParen"}]},{"Type":"NodeText","Data":""}]},{"ID":"20250915181914-msfk0qd","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-msfk0qd","updated":"20250915181914"},"Children":[{"ID":"20250915181914-wpi9qdl","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-wpi9qdl","updated":"20250915181914"},"Children":[{"ID":"20250915181914-hoamt5f","Type":"NodeParagraph","Properties":{"id":"20250915181914-hoamt5f","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"负责产品"}]},{"ID":"20250915181914-xnr3jar","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-xnr3jar","updated":"20250915181914"},"Children":[{"ID":"20250915181914-pfng6tx","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-pfng6tx","updated":"20250915181914"},"Children":[{"ID":"20250915181914-v6snd1q","Type":"NodeParagraph","Properties":{"id":"20250915181914-v6snd1q","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"PD-2111-H88L"}]}]},{"ID":"20250915181914-1qjchyj","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-1qjchyj","updated":"20250915181914"},"Children":[{"ID":"20250915181914-zsbxi6a","Type":"NodeParagraph","Properties":{"id":"20250915181914-zsbxi6a","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"负责采购"}]},{"ID":"20250915181914-ekvz0z2","Type":"NodeList","ListData":{},"Properties":{"id":"20250915181914-ekvz0z2","updated":"20250915181914"},"Children":[{"ID":"20250915181914-pnywg1x","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-pnywg1x","updated":"20250915181914"},"Children":[{"ID":"20250915181914-cvmi2k7","Type":"NodeParagraph","Properties":{"id":"20250915181914-cvmi2k7","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"秀芳姐"}]}]},{"ID":"20250915181914-84tank3","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915181914-84tank3","updated":"20250915181914"},"Children":[{"ID":"20250915181914-xeiqzzo","Type":"NodeParagraph","Properties":{"id":"20250915181914-xeiqzzo","updated":"20250915181914"},"Children":[{"Type":"NodeText","Data":"分机号2905"}]}]}]}]}]}]}]},{"ID":"20250915185616-kjx6rz7","Type":"NodeParagraph","Properties":{"id":"20250915185616-kjx6rz7","updated":"20250915185627"},"Children":[{"Type":"NodeText","Data":"一、"}]},{"ID":"20250915182128-cu01kud","Type":"NodeParagraph","Properties":{"id":"20250915182128-cu01kud","updated":"20250915185525"},"Children":[{"Type":"NodeText","Data":"\t根据客户或计划的需求日期依据产品BOM物料清单分解出所需物料种类、数量及要求到货日期查询现有库存待验和已下出的PR,PO判断可用资源找出缺料的的部分根据MOQ以及L/`T倒推下PR的日期和数量并对相关物料进行排程同步给到采购知会供应商持续跟踪交货状态能否能达到交期如不能达成交期协调生管能否调整开工日无法处理则上报物料到货后由IQC来料质量控制进行质量检验。"}]},{"ID":"20250915185638-erm8bcd","Type":"NodeParagraph","Properties":{"id":"20250915185638-erm8bcd","updated":"20250915185638"}},{"ID":"20250915184508-xsrf4xr","Type":"NodeParagraph","Properties":{"id":"20250915184508-xsrf4xr","updated":"20250915185633"},"Children":[{"Type":"NodeText","Data":"二、"}]},{"ID":"20250915184509-a0jlrg0","Type":"NodeParagraph","Properties":{"id":"20250915184509-a0jlrg0","updated":"20250915185843"},"Children":[{"Type":"NodeText","Data":"\t根据负责的物料单号查出缺料的工单协调采购厂商交货是否能达到预期"}]},{"ID":"20250915185641-ffysa66","Type":"NodeParagraph","Properties":{"id":"20250915185641-ffysa66","updated":"20250915185641"}},{"ID":"20250915185641-f39wtrc","Type":"NodeParagraph","Properties":{"id":"20250915185641-f39wtrc","updated":"20250915185641"}},{"ID":"20250915184508-o42oi8q","Type":"NodeParagraph","Properties":{"id":"20250915184508-o42oi8q","updated":"20250915184508"},"Children":[{"Type":"NodeText","Data":"物料的形式进行排程下PR。追踪物料的交期"}]},{"ID":"20250915181914-aewlif8","Type":"NodeParagraph","Properties":{"id":"20250915181914-aewlif8","updated":"20250915182608"},"Children":[{"Type":"NodeText","Data":"查库存工单缺料到货MPS计划看哪个工单缺料参考开工日背料对照MPS主计划看大概什么时候会做到缺货工单协调采购交期厂商交货是否能达到预期如不能达成交期协调生管能否调整开工。"}]},{"ID":"20250915184221-2o4f2hs","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250915184221-2o4f2hs","updated":"20250916154058"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"物控MC核心业务流程文字版"}]},{"ID":"20250915184221-1slsrjr","Type":"NodeParagraph","Properties":{"id":"20250915184221-1slsrjr","updated":"20250915184221"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"第一阶段:需求与计划"}]},{"ID":"20250915184221-yw0wrb6","Type":"NodeParagraph","Properties":{"id":"20250915184221-yw0wrb6","updated":"20250915184221"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"接收需求"},{"Type":"NodeText","Data":"从计划部PMC获取主生产计划MPS或客户订单明确生产任务。"}]},{"ID":"20250915184221-jdpa0zf","Type":"NodeParagraph","Properties":{"id":"20250915184221-jdpa0zf","updated":"20250915184221"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"分解评审"},{"Type":"NodeText","Data":"依据产品BOM物料清单分解出所需物料种类、数量及要求到货日期。"}]},{"ID":"20250915184221-bsu3ld0","Type":"NodeParagraph","Properties":{"id":"20250915184221-bsu3ld0","updated":"20250915184221"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"核查库存"},{"Type":"NodeText","Data":"查询现有库存On-hand及在途订单On-order判断可用资源。"}]},{"ID":"20250915184221-u8bb5mx","Type":"NodeParagraph","Properties":{"id":"20250915184221-u8bb5mx","updated":"20250915184221"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"采购执行"},{"Type":"NodeText","Data":"将PR转为采购订单PO下达供应商并持续跟踪交货状态。\n "},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"到货检验"},{"Type":"NodeText","Data":"物料到货后由IQC来料质量控制进行质量检验。"}]},{"ID":"20250915184221-8japbqm","Type":"NodeParagraph","Properties":{"id":"20250915184221-8japbqm","updated":"20250915184221"},"Children":[{"Type":"NodeText","Data":"核心目标是实现"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"物料不缺不囤、资金高效周转、质量精准追溯"},{"Type":"NodeText","Data":"。"}]},{"ID":"20250915182058-otuxvhc","Type":"NodeList","ListData":{},"Properties":{"id":"20250915182058-otuxvhc","updated":"20250915182058"},"Children":[{"ID":"20250915182058-c2omrd7","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915182058-c2omrd7","updated":"20250915182058"},"Children":[{"ID":"20250915182058-baghdm8","Type":"NodeParagraph","Properties":{"id":"20250915182058-baghdm8","updated":"20250915182058"},"Children":[{"Type":"NodeText","Data":"每个人分配一些材料号,该材料可能有多个地方使用的需求,根据工单\u0026PO的需求日期按照厂商L\u0026T以及产品的仓储成本确定做排程OR交期注意避开节假日海外产品注意香港假期缺料下PR到采购排程交期追采购找供应商"}]}]},{"ID":"20250915182058-w826skq","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250915182058-w826skq","updated":"20250915182058"},"Children":[{"ID":"20250915182058-wvoi3yn","Type":"NodeParagraph","Properties":{"id":"20250915182058-wvoi3yn","updated":"20250915182058"}}]}]},{"ID":"20250915203111-06idtzd","Type":"NodeParagraph","Properties":{"id":"20250915203111-06idtzd","updated":"20250915203111"}},{"ID":"20250915203112-vpvdgt9","Type":"NodeParagraph","Properties":{"id":"20250915203112-vpvdgt9","updated":"20250915203112"}},{"ID":"20250915203113-qzkr88o","Type":"NodeParagraph","Properties":{"id":"20250915203113-qzkr88o","updated":"20250915203113"},"Children":[{"Type":"NodeText","Data":"MC一把手"}]},{"ID":"20250915203113-v66rgjr","Type":"NodeParagraph","Properties":{"id":"20250915203113-v66rgjr","updated":"20250915203113"},"Children":[{"Type":"NodeText","Data":"重点"}]},{"ID":"20250915203113-twjcjgs","Type":"NodeParagraph","Properties":{"id":"20250915203113-twjcjgs","updated":"20250915203113"},"Children":[{"Type":"NodeText","Data":"1.全厂库存额"}]},{"ID":"20250915203113-92gbez8","Type":"NodeParagraph","Properties":{"id":"20250915203113-92gbez8","updated":"20250916152219"},"Children":[{"Type":"NodeText","Data":"2.呆积料(财务发报表)"}]},{"ID":"20250915203113-c9vun20","Type":"NodeParagraph","Properties":{"id":"20250915203113-c9vun20","updated":"20250915203113"},"Children":[{"Type":"NodeText","Data":"3.库存金额/销售额"}]},{"ID":"20250915203113-ge8376i","Type":"NodeParagraph","Properties":{"id":"20250915203113-ge8376i","updated":"20250915203113"},"Children":[{"Type":"NodeText","Data":"4.安全库存"}]},{"ID":"20250915203113-arfu8j6","Type":"NodeParagraph","Properties":{"id":"20250915203113-arfu8j6","updated":"20250915203113"}},{"ID":"20250916154057-jr4mz45","Type":"NodeParagraph","Properties":{"id":"20250916154057-jr4mz45","updated":"20250916154057"}},{"ID":"20250916154057-og7r02n","Type":"NodeParagraph","Properties":{"id":"20250916154057-og7r02n","updated":"20250916154057"}},{"ID":"20250916154057-aw9yyel","Type":"NodeParagraph","Properties":{"id":"20250916154057-aw9yyel","updated":"20250916154057"}},{"ID":"20250916154058-7ol4btb","Type":"NodeParagraph","Properties":{"id":"20250916154058-7ol4btb","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"根据你的需求我将编写一个VBA程序来生成两张新表一张是展开后的材料需求表包含材料料号和每个week的计算值另一张是未匹配到BOM的主键料号列表。"}]},{"ID":"20250916154058-zc6e6t9","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250916154058-zc6e6t9","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"思路:"}]},{"ID":"20250916154058-nwyli9w","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250916154058-nwyli9w","updated":"20250916154058"},"Children":[{"ID":"20250916154058-qa8rg8b","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250916154058-qa8rg8b","updated":"20250916154058"},"Children":[{"ID":"20250916154058-qns1mqn","Type":"NodeParagraph","Properties":{"id":"20250916154058-qns1mqn","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"读取Focest表的数据主键料号、LIC、week1-week56。"}]}]},{"ID":"20250916154058-bqku2ao","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250916154058-bqku2ao","updated":"20250916154058"},"Children":[{"ID":"20250916154058-rm094x1","Type":"NodeParagraph","Properties":{"id":"20250916154058-rm094x1","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"读取BOM表的数据主键料号、材料料号、用量。"}]}]},{"ID":"20250916154058-f14g2z6","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250916154058-f14g2z6","updated":"20250916154058"},"Children":[{"ID":"20250916154058-2r72hzb","Type":"NodeParagraph","Properties":{"id":"20250916154058-2r72hzb","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"对于每个主键料号在BOM表中查找对应的材料料号和用量然后计算每个week的值week * LIC * 用量)。"}]}]},{"ID":"20250916154058-27ki9t7","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NC4=","Num":4},"Properties":{"id":"20250916154058-27ki9t7","updated":"20250916154058"},"Children":[{"ID":"20250916154058-q87qhrp","Type":"NodeParagraph","Properties":{"id":"20250916154058-q87qhrp","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"生成新表列包括材料料号和week1到week56的计算值。"}]}]},{"ID":"20250916154058-b4edbqj","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NS4=","Num":5},"Properties":{"id":"20250916154058-b4edbqj","updated":"20250916154058"},"Children":[{"ID":"20250916154058-vbbxinj","Type":"NodeParagraph","Properties":{"id":"20250916154058-vbbxinj","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"同时收集Focest表中存在但BOM表中不存在的主键料号生成另一张表。"}]}]}]},{"ID":"20250916154058-vbwz95e","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250916154058-vbwz95e","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"代码实现:"}]},{"ID":"20250916154058-0jrrsak","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916154058-0jrrsak","updated":"20250916154058"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub GenerateNewSheets()\n Dim wsFocest As Worksheet, wsBOM As Worksheet, wsOutput As Worksheet, wsUnmatched As Worksheet\n Dim lastRowF As Long, lastRowB As Long, lastRowO As Long, lastRowU As Long\n Dim i As Long, j As Long, k As Long, col As Long\n Dim keyPart As String, material As String, usage As Double\n Dim lic As Double\n Dim weekValues(1 To 56) As Double\n Dim dictBOM As Object, dictUnmatched As Object\n Set dictBOM = CreateObject(\"Scripting.Dictionary\")\n Set dictUnmatched = CreateObject(\"Scripting.Dictionary\")\n \n ' 设置工作表\n Set wsFocest = ThisWorkbook.Sheets(\"Focest\") ' 根据实际表名修改\n Set wsBOM = ThisWorkbook.Sheets(\"BOM\") ' 根据实际表名修改\n \n ' 创建新工作表用于输出\n On Error Resume Next\n Application.DisplayAlerts = False\n ThisWorkbook.Sheets(\"Output\").Delete\n ThisWorkbook.Sheets(\"Unmatched\").Delete\n Application.DisplayAlerts = True\n On Error GoTo 0\n \n Set wsOutput = ThisWorkbook.Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count))\n wsOutput.Name = \"Output\"\n Set wsUnmatched = ThisWorkbook.Sheets.Add(After:=wsOutput)\n wsUnmatched.Name = \"Unmatched\"\n \n ' 读取BOM表数据到字典\n lastRowB = wsBOM.Cells(wsBOM.Rows.Count, \"A\").End(xlUp).Row\n For i = 2 To lastRowB ' 假设第一行是标题\n keyPart = wsBOM.Cells(i, 1).Value ' 主键料号\n material = wsBOM.Cells(i, 2).Value ' 材料料号\n usage = wsBOM.Cells(i, 3).Value ' 用量\n \n If Not dictBOM.Exists(keyPart) Then\n dictBOM.Add keyPart, New Collection\n End If\n dictBOM(keyPart).Add Array(material, usage)\n Next i\n \n ' 准备Output表头\n wsOutput.Cells(1, 1).Value = \"材料料号\"\n For col = 1 To 56\n wsOutput.Cells(1, col + 1).Value = \"Week\" \u0026 col\n Next col\n \n ' 处理Focest表\n lastRowF = wsFocest.Cells(wsFocest.Rows.Count, \"A\").End(xlUp).Row\n lastRowO = 1 ' 输出表当前行\n \n For i = 2 To lastRowF ' 假设第一行是标题\n keyPart = wsFocest.Cells(i, 1).Value\n lic = wsFocest.Cells(i, 2).Value ' LIC列假设是第2列\n \n ' 提取week值假设从第3列到第58列是week1-week56\n For j = 1 To 56\n weekValues(j) = wsFocest.Cells(i, j + 2).Value\n Next j\n \n If dictBOM.Exists(keyPart) Then\n ' 对于每个材料料号\n For k = 1 To dictBOM(keyPart).Count\n material = dictBOM(keyPart)(k)(0)\n usage = dictBOM(keyPart)(k)(1)\n lastRowO = lastRowO + 1\n wsOutput.Cells(lastRowO, 1).Value = material\n For col = 1 To 56\n wsOutput.Cells(lastRowO, col + 1).Value = weekValues(col) * lic * usage\n Next col\n Next k\n Else\n ' 记录未匹配的主键料号\n If Not dictUnmatched.Exists(keyPart) Then\n dictUnmatched.Add keyPart, True\n End If\n End If\n Next i\n \n ' 生成未匹配表\n lastRowU = 1\n wsUnmatched.Cells(1, 1).Value = \"未匹配主键料号\"\n For Each keyPart In dictUnmatched.Keys\n lastRowU = lastRowU + 1\n wsUnmatched.Cells(lastRowU, 1).Value = keyPart\n Next keyPart\n \n ' 调整列宽\n wsOutput.Columns.AutoFit\n wsUnmatched.Columns.AutoFit\n \n MsgBox \"处理完成!\"\nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916154058-f89d32u","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250916154058-f89d32u","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"使用说明:"}]},{"ID":"20250916154058-r6lfcdp","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250916154058-r6lfcdp","updated":"20250916154058"},"Children":[{"ID":"20250916154058-ee2gnok","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250916154058-ee2gnok","updated":"20250916154058"},"Children":[{"ID":"20250916154058-83anegc","Type":"NodeParagraph","Properties":{"id":"20250916154058-83anegc","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"请根据实际表名修改代码中的"},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"wsFocest"},{"Type":"NodeText","Data":"​和"},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"wsBOM"},{"Type":"NodeText","Data":"​的赋值。"}]}]},{"ID":"20250916154058-6v8q5br","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250916154058-6v8q5br","updated":"20250916154058"},"Children":[{"ID":"20250916154058-8nmdwio","Type":"NodeParagraph","Properties":{"id":"20250916154058-8nmdwio","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"确保Focest表中LIC列是第2列week1-week56从第3列开始即C列到BH列。"}]}]},{"ID":"20250916154058-y5gu4rq","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250916154058-y5gu4rq","updated":"20250916154058"},"Children":[{"ID":"20250916154058-mnbynhq","Type":"NodeParagraph","Properties":{"id":"20250916154058-mnbynhq","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"确保BOM表中主键料号、材料料号、用量分别在第1、2、3列。"}]}]},{"ID":"20250916154058-1iggwml","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NC4=","Num":4},"Properties":{"id":"20250916154058-1iggwml","updated":"20250916154058"},"Children":[{"ID":"20250916154058-jltw38v","Type":"NodeParagraph","Properties":{"id":"20250916154058-jltw38v","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"运行宏后,将生成两张新表:\"Output\"(材料需求表)和\"Unmatched\"(未匹配的主键料号)。"}]}]}]},{"ID":"20250916154058-d3fniy8","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250916154058-d3fniy8","updated":"20250916154826"},"Children":[{"Type":"NodeText","Data":"注意事项:"}]},{"ID":"20250916154058-jowqyi6","Type":"NodeList","ListData":{},"Properties":{"id":"20250916154058-jowqyi6","updated":"20250916154058"},"Children":[{"ID":"20250916154058-z78kh2i","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250916154058-z78kh2i","updated":"20250916154058"},"Children":[{"ID":"20250916154058-rfby0ui","Type":"NodeParagraph","Properties":{"id":"20250916154058-rfby0ui","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"代码假设数据从第2行开始第1行为标题。"}]}]},{"ID":"20250916154058-5a1lfva","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250916154058-5a1lfva","updated":"20250916154058"},"Children":[{"ID":"20250916154058-o8k1wjy","Type":"NodeParagraph","Properties":{"id":"20250916154058-o8k1wjy","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"如果数据量很大,运行可能需要一些时间。"}]}]},{"ID":"20250916154058-z0ni6pe","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250916154058-z0ni6pe","updated":"20250916154058"},"Children":[{"ID":"20250916154058-spi7ynn","Type":"NodeParagraph","Properties":{"id":"20250916154058-spi7ynn","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"如果遇到类型不匹配错误请检查LIC和用量的值是否为数字。"}]}]}]},{"ID":"20250916154058-l2goh9l","Type":"NodeParagraph","Properties":{"id":"20250916154058-l2goh9l","updated":"20250916154058"},"Children":[{"Type":"NodeText","Data":"如果需要进一步调整,请提供更多细节。"}]},{"ID":"20250916154807-6pjxls1","Type":"NodeParagraph","Properties":{"id":"20250916154807-6pjxls1","updated":"20250916154807"}},{"ID":"20250916154826-xrpkyx2","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916154826-xrpkyx2","updated":"20250916154826"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub GenerateNewSheets()\n Dim wsFocest As Worksheet, wsBOM As Worksheet, wsOutput As Worksheet, wsUnmatched As Worksheet\n Dim lastRowF As Long, lastRowB As Long, lastRowO As Long, lastRowU As Long\n Dim i As Long, j As Long, k As Long, col As Long\n Dim keyPart As String, material As String, usage As Double\n Dim lic As Double\n Dim weekValues(1 To 56) As Double\n Dim dictBOM As Object, dictUnmatched As Object\n Set dictBOM = CreateObject(\"Scripting.Dictionary\")\n Set dictUnmatched = CreateObject(\"Scripting.Dictionary\")\n \n ' Set worksheets\n Set wsFocest = ThisWorkbook.Sheets(\"Focest\") ' Modify according to actual sheet name\n Set wsBOM = ThisWorkbook.Sheets(\"BOM\") ' Modify according to actual sheet name\n \n ' Create new worksheets for output\n On Error Resume Next\n Application.DisplayAlerts = False\n ThisWorkbook.Sheets(\"Output\").Delete\n ThisWorkbook.Sheets(\"Unmatched\").Delete\n Application.DisplayAlerts = True\n On Error GoTo 0\n \n Set wsOutput = ThisWorkbook.Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count))\n wsOutput.Name = \"Output\"\n Set wsUnmatched = ThisWorkbook.Sheets.Add(After:=wsOutput)\n wsUnmatched.Name = \"Unmatched\"\n \n ' Read BOM data into dictionary\n lastRowB = wsBOM.Cells(wsBOM.Rows.Count, \"A\").End(xlUp).Row\n For i = 2 To lastRowB ' Assuming first row is header\n keyPart = wsBOM.Cells(i, 1).Value ' Key part number\n material = wsBOM.Cells(i, 2).Value ' Material number\n usage = wsBOM.Cells(i, 3).Value ' Usage quantity\n \n If Not dictBOM.Exists(keyPart) Then\n dictBOM.Add keyPart, New Collection\n End If\n dictBOM(keyPart).Add Array(material, usage)\n Next i\n \n ' Prepare Output header\n wsOutput.Cells(1, 1).Value = \"Material Number\"\n For col = 1 To 56\n wsOutput.Cells(1, col + 1).Value = \"Week\" \u0026 col\n Next col\n \n ' Process Focest table\n lastRowF = wsFocest.Cells(wsFocest.Rows.Count, \"A\").End(xlUp).Row\n lastRowO = 1 ' Current row in output sheet\n \n For i = 2 To lastRowF ' Assuming first row is header\n keyPart = wsFocest.Cells(i, 1).Value\n lic = wsFocest.Cells(i, 2).Value ' LIC column, assuming it's column 2\n \n ' Extract week values (assuming columns 3 to 58 are week1-week56)\n For j = 1 To 56\n weekValues(j) = wsFocest.Cells(i, j + 2).Value\n Next j\n \n If dictBOM.Exists(keyPart) Then\n ' For each material number\n For k = 1 To dictBOM(keyPart).Count\n material = dictBOM(keyPart)(k)(0)\n usage = dictBOM(keyPart)(k)(1)\n lastRowO = lastRowO + 1\n wsOutput.Cells(lastRowO, 1).Value = material\n For col = 1 To 56\n wsOutput.Cells(lastRowO, col + 1).Value = weekValues(col) * lic * usage\n Next col\n Next k\n Else\n ' Record unmatched key part numbers\n If Not dictUnmatched.Exists(keyPart) Then\n dictUnmatched.Add keyPart, True\n End If\n End If\n Next i\n \n ' Generate unmatched sheet\n lastRowU = 1\n wsUnmatched.Cells(1, 1).Value = \"Unmatched Key Part Numbers\"\n For Each keyPart In dictUnmatched.Keys\n lastRowU = lastRowU + 1\n wsUnmatched.Cells(lastRowU, 1).Value = keyPart\n Next keyPart\n \n ' Auto-fit columns\n wsOutput.Columns.AutoFit\n wsUnmatched.Columns.AutoFit\n \n MsgBox \"Processing completed!\"\nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916154826-1dsh6ud","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250916154826-1dsh6ud","updated":"20250916154826"},"Children":[{"Type":"NodeText","Data":"Usage Notes:"}]},{"ID":"20250916154826-z32uo5x","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250916154826-z32uo5x","updated":"20250916154826"},"Children":[{"ID":"20250916154825-i80sf8v","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250916154825-i80sf8v","updated":"20250916154825"},"Children":[{"ID":"20250916154826-5gibyea","Type":"NodeParagraph","Properties":{"id":"20250916154826-5gibyea","updated":"20250916154826"},"Children":[{"Type":"NodeText","Data":"Please modify the "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"wsFocest"},{"Type":"NodeText","Data":" and "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"wsBOM"},{"Type":"NodeText","Data":" assignments according to your actual sheet names."}]}]},{"ID":"20250916154826-skovsnl","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250916154826-skovsnl","updated":"20250916154826"},"Children":[{"ID":"20250916154826-tthiv39","Type":"NodeParagraph","Properties":{"id":"20250916154826-tthiv39","updated":"20250916154826"},"Children":[{"Type":"NodeText","Data":"Ensure the LIC column is column 2 in the Focest table, and week1-week56 are in columns 3 to 58 (C to BH)."}]}]},{"ID":"20250916154826-2fwyx84","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250916154826-2fwyx84","updated":"20250916154826"},"Children":[{"ID":"20250916154826-cuf6ubs","Type":"NodeParagraph","Properties":{"id":"20250916154826-cuf6ubs","updated":"20250916154826"},"Children":[{"Type":"NodeText","Data":"Ensure the key part number, material number, and usage quantity are in columns 1, 2, and 3 respectively in the BOM table."}]}]},{"ID":"20250916154826-jx65yp0","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NC4=","Num":4},"Properties":{"id":"20250916154826-jx65yp0","updated":"20250916154826"},"Children":[{"ID":"20250916154826-3t45p0j","Type":"NodeParagraph","Properties":{"id":"20250916154826-3t45p0j","updated":"20250916154826"},"Children":[{"Type":"NodeText","Data":"After running the macro, two new sheets will be created: \"Output\" (material requirements) and \"Unmatched\" (unmatched key part numbers)."}]}]}]},{"ID":"20250916154826-u4o7bpn","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250916154826-u4o7bpn","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"Important:"}]},{"ID":"20250916154826-8kzck9c","Type":"NodeList","ListData":{},"Properties":{"id":"20250916154826-8kzck9c","updated":"20250916154826"},"Children":[{"ID":"20250916154826-t31z61n","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250916154826-t31z61n","updated":"20250916154826"},"Children":[{"ID":"20250916154826-nbq0whl","Type":"NodeParagraph","Properties":{"id":"20250916154826-nbq0whl","updated":"20250916154826"},"Children":[{"Type":"NodeText","Data":"The code assumes data starts from row 2 (row 1 is headers)."}]}]},{"ID":"20250916154826-39v0la9","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250916154826-39v0la9","updated":"20250916154826"},"Children":[{"ID":"20250916154826-2vjwaee","Type":"NodeParagraph","Properties":{"id":"20250916154826-2vjwaee","updated":"20250916154826"},"Children":[{"Type":"NodeText","Data":"Processing may take some time if you have large datasets."}]}]},{"ID":"20250916154826-xg1ftui","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250916154826-xg1ftui","updated":"20250916154826"},"Children":[{"ID":"20250916154826-n85bxv5","Type":"NodeParagraph","Properties":{"id":"20250916154826-n85bxv5","updated":"20250916154826"},"Children":[{"Type":"NodeText","Data":"If you encounter type mismatch errors, please check if LIC and usage values are numeric."}]}]}]},{"ID":"20250916154826-i8jcoid","Type":"NodeParagraph","Properties":{"id":"20250916154826-i8jcoid","updated":"20250916154826"},"Children":[{"Type":"NodeText","Data":"Let me know if you need any further adjustments!"}]},{"ID":"20250916155024-zd35yha","Type":"NodeParagraph","Properties":{"id":"20250916155024-zd35yha","updated":"20250916155024"}},{"ID":"20250916155025-w2msbh9","Type":"NodeParagraph","Properties":{"id":"20250916155025-w2msbh9","updated":"20250916155025"}},{"ID":"20250916155025-7gc3dva","Type":"NodeParagraph","Properties":{"id":"20250916155025-7gc3dva","updated":"20250916155025"}},{"ID":"20250916155055-fnk9m91","Type":"NodeParagraph","Properties":{"id":"20250916155055-fnk9m91","updated":"20250916155055"},"Children":[{"Type":"NodeText","Data":"这个错误通常是因为字典中的键值对集合操作有问题。让我修复代码:"}]},{"ID":"20250916155055-on6gq35","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916155055-on6gq35","updated":"20250916155055"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub GenerateNewSheets()\n Dim wsFocest As Worksheet, wsBOM As Worksheet, wsOutput As Worksheet, wsUnmatched As Worksheet\n Dim lastRowF As Long, lastRowB As Long, lastRowO As Long, lastRowU As Long\n Dim i As Long, j As Long, k As Long, col As Long\n Dim keyPart As String, material As String, usage As Double\n Dim lic As Double\n Dim weekValues(1 To 56) As Double\n Dim dictBOM As Object, dictUnmatched As Object\n Dim materialData As Variant\n Dim key As Variant\n \n Set dictBOM = CreateObject(\"Scripting.Dictionary\")\n Set dictUnmatched = CreateObject(\"Scripting.Dictionary\")\n \n ' Set worksheets\n Set wsFocest = ThisWorkbook.Sheets(\"Focest\") ' Modify according to actual sheet name\n Set wsBOM = ThisWorkbook.Sheets(\"BOM\") ' Modify according to actual sheet name\n \n ' Create new worksheets for output\n On Error Resume Next\n Application.DisplayAlerts = False\n ThisWorkbook.Sheets(\"Output\").Delete\n ThisWorkbook.Sheets(\"Unmatched\").Delete\n Application.DisplayAlerts = True\n On Error GoTo 0\n \n Set wsOutput = ThisWorkbook.Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count))\n wsOutput.Name = \"Output\"\n Set wsUnmatched = ThisWorkbook.Sheets.Add(After:=wsOutput)\n wsUnmatched.Name = \"Unmatched\"\n \n ' Read BOM data into dictionary\n lastRowB = wsBOM.Cells(wsBOM.Rows.Count, \"A\").End(xlUp).Row\n For i = 2 To lastRowB ' Assuming first row is header\n keyPart = wsBOM.Cells(i, 1).Value ' Key part number\n material = wsBOM.Cells(i, 2).Value ' Material number\n usage = wsBOM.Cells(i, 3).Value ' Usage quantity\n \n If keyPart \u003c\u003e \"\" Then\n If Not dictBOM.Exists(keyPart) Then\n dictBOM.Add keyPart, New Collection\n End If\n dictBOM(keyPart).Add Array(material, usage)\n End If\n Next i\n \n ' Prepare Output header\n wsOutput.Cells(1, 1).Value = \"Material Number\"\n For col = 1 To 56\n wsOutput.Cells(1, col + 1).Value = \"Week\" \u0026 col\n Next col\n \n ' Process Focest table\n lastRowF = wsFocest.Cells(wsFocest.Rows.Count, \"A\").End(xlUp).Row\n lastRowO = 1 ' Current row in output sheet\n \n For i = 2 To lastRowF ' Assuming first row is header\n keyPart = wsFocest.Cells(i, 1).Value\n If keyPart = \"\" Then GoTo NextRow\n \n lic = wsFocest.Cells(i, 2).Value ' LIC column, assuming it's column 2\n \n ' Extract week values (assuming columns 3 to 58 are week1-week56)\n For j = 1 To 56\n weekValues(j) = wsFocest.Cells(i, j + 2).Value\n If IsEmpty(weekValues(j)) Then weekValues(j) = 0\n Next j\n \n If dictBOM.Exists(keyPart) Then\n ' For each material number\n For k = 1 To dictBOM(keyPart).Count\n materialData = dictBOM(keyPart)(k)\n material = materialData(0)\n usage = materialData(1)\n lastRowO = lastRowO + 1\n wsOutput.Cells(lastRowO, 1).Value = material\n For col = 1 To 56\n wsOutput.Cells(lastRowO, col + 1).Value = weekValues(col) * lic * usage\n Next col\n Next k\n Else\n ' Record unmatched key part numbers\n If Not dictUnmatched.Exists(keyPart) Then\n dictUnmatched.Add keyPart, True\n End If\n End If\n \nNextRow:\n Next i\n \n ' Generate unmatched sheet\n lastRowU = 1\n wsUnmatched.Cells(1, 1).Value = \"Unmatched Key Part Numbers\"\n \n ' Use proper iteration for dictionary keys\n Dim keys As Variant\n keys = dictUnmatched.Keys\n For i = 0 To dictUnmatched.Count - 1\n lastRowU = lastRowU + 1\n wsUnmatched.Cells(lastRowU, 1).Value = keys(i)\n Next i\n \n ' Alternative method using For Each (more reliable)\n ' For Each key In dictUnmatched.Keys\n ' lastRowU = lastRowU + 1\n ' wsUnmatched.Cells(lastRowU, 1).Value = key\n ' Next key\n \n ' Auto-fit columns\n wsOutput.Columns.AutoFit\n wsUnmatched.Columns.AutoFit\n \n MsgBox \"Processing completed! \" \u0026 lastRowO - 1 \u0026 \" rows generated in Output sheet.\"\nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916155055-0jlawq4","Type":"NodeParagraph","Properties":{"id":"20250916155055-0jlawq4","updated":"20250916155055"},"Children":[{"Type":"NodeText","Data":"主要修改:"}]},{"ID":"20250916155055-15mw28i","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250916155055-15mw28i","updated":"20250916155055"},"Children":[{"ID":"20250916155055-lnixf5j","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250916155055-lnixf5j","updated":"20250916155055"},"Children":[{"ID":"20250916155055-ldjka8z","Type":"NodeParagraph","Properties":{"id":"20250916155055-ldjka8z","updated":"20250916155055"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"添加了空值检查"},{"Type":"NodeText","Data":":在读取数据时检查空值,避免处理空单元格"}]}]},{"ID":"20250916155055-mpoa84h","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250916155055-mpoa84h","updated":"20250916155055"},"Children":[{"ID":"20250916155055-d8b31iu","Type":"NodeParagraph","Properties":{"id":"20250916155055-d8b31iu","updated":"20250916155055"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"改进了字典迭代"},{"Type":"NodeText","Data":":使用数组方式迭代字典键值,避免 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"For Each"},{"Type":"NodeText","Data":" 问题"}]}]},{"ID":"20250916155055-icv87ia","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250916155055-icv87ia","updated":"20250916155055"},"Children":[{"ID":"20250916155055-vicy0ey","Type":"NodeParagraph","Properties":{"id":"20250916155055-vicy0ey","updated":"20250916155055"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"添加了错误处理"},{"Type":"NodeText","Data":"为空值设置默认值0"}]}]},{"ID":"20250916155055-xscos1w","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NC4=","Num":4},"Properties":{"id":"20250916155055-xscos1w","updated":"20250916155055"},"Children":[{"ID":"20250916155055-45hcnsx","Type":"NodeParagraph","Properties":{"id":"20250916155055-45hcnsx","updated":"20250916155055"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"改进了变量声明"},{"Type":"NodeText","Data":":明确声明所有变量"}]}]},{"ID":"20250916155055-kck0huf","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NS4=","Num":5},"Properties":{"id":"20250916155055-kck0huf","updated":"20250916155055"},"Children":[{"ID":"20250916155055-tw23clc","Type":"NodeParagraph","Properties":{"id":"20250916155055-tw23clc","updated":"20250916155055"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"添加了进度反馈"},{"Type":"NodeText","Data":":显示生成的行数"}]}]}]},{"ID":"20250916155055-yhhlg4x","Type":"NodeParagraph","Properties":{"id":"20250916155055-yhhlg4x","updated":"20250916155055"},"Children":[{"Type":"NodeText","Data":"如果仍然有问题,请告诉我具体的错误信息,我可以进一步调整代码。"}]},{"ID":"20250916165807-5yt3x86","Type":"NodeParagraph","Properties":{"id":"20250916165807-5yt3x86","updated":"20250916165807"}},{"ID":"20250916165808-2mzh3gn","Type":"NodeParagraph","Properties":{"id":"20250916165808-2mzh3gn","updated":"20250916165808"}},{"ID":"20250916165808-jj3o9jm","Type":"NodeParagraph","Properties":{"id":"20250916165808-jj3o9jm","updated":"20250916165808"}},{"ID":"20250916165811-qfs0359","Type":"NodeParagraph","Properties":{"id":"20250916165811-qfs0359","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"在Excel中同时查找两个单元格即基于两个条件进行查找有多种方法。以下是几种最常用的方法从简单到高级"}]},{"ID":"20250916165811-uzjvlxz","Type":"NodeHeading","HeadingLevel":2,"Properties":{"id":"20250916165811-uzjvlxz","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"方法一:使用 FILTER 函数 (推荐适用于Microsoft 365、Excel 2021)"}]},{"ID":"20250916165811-b4m9l0s","Type":"NodeParagraph","Properties":{"id":"20250916165811-b4m9l0s","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"这是最简单直接的方法如果你有最新版本的Excel。"}]},{"ID":"20250916165811-pdhzkxl","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916165811-pdhzkxl","updated":"20250916165811"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"ZXhjZWw="},{"Type":"NodeCodeBlockCode","Data":"=FILTER(返回区域, (条件区域1=条件1) * (条件区域2=条件2), \"未找到\")\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916165811-708wlk5","Type":"NodeParagraph","Properties":{"id":"20250916165811-708wlk5","updated":"20250916165811"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"示例"},{"Type":"NodeText","Data":"在A列找\"张三\"在B列找\"销售部\"返回C列的工资"}]},{"ID":"20250916165811-ovfacct","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916165811-ovfacct","updated":"20250916165811"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"ZXhjZWw="},{"Type":"NodeCodeBlockCode","Data":"=FILTER(C2:C100, (A2:A100=\"张三\") * (B2:B100=\"销售部\"), \"未找到\")\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916165811-yk6fuhq","Type":"NodeHeading","HeadingLevel":2,"Properties":{"id":"20250916165811-yk6fuhq","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"方法二:使用 XLOOKUP 函数 (Microsoft 365、Excel 2021)"}]},{"ID":"20250916165811-flbczp2","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916165811-flbczp2","updated":"20250916165811"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"ZXhjZWw="},{"Type":"NodeCodeBlockCode","Data":"=XLOOKUP(1, (条件区域1=条件1) * (条件区域2=条件2), 返回区域, \"未找到\")\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916165811-m4v3bc6","Type":"NodeParagraph","Properties":{"id":"20250916165811-m4v3bc6","updated":"20250916165811"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"示例"},{"Type":"NodeText","Data":""}]},{"ID":"20250916165811-j5bqkdu","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916165811-j5bqkdu","updated":"20250916165811"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"ZXhjZWw="},{"Type":"NodeCodeBlockCode","Data":"=XLOOKUP(1, (A2:A100=\"张三\") * (B2:B100=\"销售部\"), C2:C100, \"未找到\")\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916165811-tedz8vy","Type":"NodeHeading","HeadingLevel":2,"Properties":{"id":"20250916165811-tedz8vy","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"方法三:使用 INDEX + MATCH 组合 (兼容所有Excel版本)"}]},{"ID":"20250916165811-mhdjlaq","Type":"NodeParagraph","Properties":{"id":"20250916165811-mhdjlaq","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"这是最经典的兼容性最好的方法。"}]},{"ID":"20250916165811-i7yxpm3","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916165811-i7yxpm3","updated":"20250916165811"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"ZXhjZWw="},{"Type":"NodeCodeBlockCode","Data":"=INDEX(返回区域, MATCH(1, (条件区域1=条件1) * (条件区域2=条件2), 0))\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916165811-hc6tiax","Type":"NodeParagraph","Properties":{"id":"20250916165811-hc6tiax","updated":"20250916165811"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"注意"},{"Type":"NodeText","Data":"这是数组公式在旧版Excel中需要按 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Ctrl+Shift+Enter"},{"Type":"NodeText","Data":" 确认。"}]},{"ID":"20250916165811-sqpyid6","Type":"NodeParagraph","Properties":{"id":"20250916165811-sqpyid6","updated":"20250916165811"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"示例"},{"Type":"NodeText","Data":""}]},{"ID":"20250916165811-c34ngur","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916165811-c34ngur","updated":"20250916165811"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"ZXhjZWw="},{"Type":"NodeCodeBlockCode","Data":"=INDEX(C2:C100, MATCH(1, (A2:A100=\"张三\") * (B2:B100=\"销售部\"), 0))\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916165811-37oki61","Type":"NodeHeading","HeadingLevel":2,"Properties":{"id":"20250916165811-37oki61","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"方法四:使用 SUMIFS 函数 (适用于数值求和)"}]},{"ID":"20250916165811-uikxcdd","Type":"NodeParagraph","Properties":{"id":"20250916165811-uikxcdd","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"如果是要对数值进行条件求和,这是最好的选择。"}]},{"ID":"20250916165811-kn1r43l","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916165811-kn1r43l","updated":"20250916165811"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"ZXhjZWw="},{"Type":"NodeCodeBlockCode","Data":"=SUMIFS(求和区域, 条件区域1, 条件1, 条件区域2, 条件2)\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916165811-s4gq1tw","Type":"NodeParagraph","Properties":{"id":"20250916165811-s4gq1tw","updated":"20250916165811"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"示例"},{"Type":"NodeText","Data":":求张三在销售部的总工资"}]},{"ID":"20250916165811-3mosuer","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916165811-3mosuer","updated":"20250916165811"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"ZXhjZWw="},{"Type":"NodeCodeBlockCode","Data":"=SUMIFS(C2:C100, A2:A100, \"张三\", B2:B100, \"销售部\")\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916165811-jy3mn23","Type":"NodeHeading","HeadingLevel":2,"Properties":{"id":"20250916165811-jy3mn23","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"方法五:使用数据透视表"}]},{"ID":"20250916165811-saduu5q","Type":"NodeParagraph","Properties":{"id":"20250916165811-saduu5q","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"对于复杂的数据分析,数据透视表是最强大的工具。"}]},{"ID":"20250916165811-ivw4avf","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250916165811-ivw4avf","updated":"20250916165811"},"Children":[{"ID":"20250916165811-ecursva","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250916165811-ecursva","updated":"20250916165811"},"Children":[{"ID":"20250916165811-64cn5u6","Type":"NodeParagraph","Properties":{"id":"20250916165811-64cn5u6","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"选择你的数据区域"}]}]},{"ID":"20250916165811-oyg7f5f","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250916165811-oyg7f5f","updated":"20250916165811"},"Children":[{"ID":"20250916165811-sqwu8ir","Type":"NodeParagraph","Properties":{"id":"20250916165811-sqwu8ir","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"点击「插入」\u003e「数据透视表」"}]}]},{"ID":"20250916165811-zsinlmi","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250916165811-zsinlmi","updated":"20250916165811"},"Children":[{"ID":"20250916165811-i80jc85","Type":"NodeParagraph","Properties":{"id":"20250916165811-i80jc85","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"将两个条件字段拖到「行」或「筛选器」区域"}]}]},{"ID":"20250916165811-f6qhekv","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NC4=","Num":4},"Properties":{"id":"20250916165811-f6qhekv","updated":"20250916165811"},"Children":[{"ID":"20250916165811-jknaf14","Type":"NodeParagraph","Properties":{"id":"20250916165811-jknaf14","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"将需要返回的字段拖到「值」区域"}]}]}]},{"ID":"20250916165811-oydw359","Type":"NodeHeading","HeadingLevel":2,"Properties":{"id":"20250916165811-oydw359","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"实用示例"}]},{"ID":"20250916165811-zgyeybu","Type":"NodeParagraph","Properties":{"id":"20250916165811-zgyeybu","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"假设有以下数据:"}]},{"ID":"20250916165811-ha527aq","Type":"NodeTable","TableAligns":[0,0,0],"Properties":{"colgroup":"||","id":"20250916165811-ha527aq","updated":"20250916165811"},"Children":[{"Type":"NodeTableHead","Data":"thead","Children":[{"Type":"NodeTableRow","Data":"tr","Children":[{"Type":"NodeTableCell","Data":"th","Children":[{"Type":"NodeText","Data":"姓名"}]},{"Type":"NodeTableCell","Data":"th","Children":[{"Type":"NodeText","Data":"部门"}]},{"Type":"NodeTableCell","Data":"th","Children":[{"Type":"NodeText","Data":"工资"}]}]}]},{"Type":"NodeTableRow","Data":"tr","Children":[{"Type":"NodeTableCell","Data":"td","Children":[{"Type":"NodeText","Data":"张三"}]},{"Type":"NodeTableCell","Data":"td","Children":[{"Type":"NodeText","Data":"销售部"}]},{"Type":"NodeTableCell","Data":"td","Children":[{"Type":"NodeText","Data":"5000"}]}]},{"Type":"NodeTableRow","Data":"tr","Children":[{"Type":"NodeTableCell","Data":"td","Children":[{"Type":"NodeText","Data":"李四"}]},{"Type":"NodeTableCell","Data":"td","Children":[{"Type":"NodeText","Data":"技术部"}]},{"Type":"NodeTableCell","Data":"td","Children":[{"Type":"NodeText","Data":"6000"}]}]},{"Type":"NodeTableRow","Data":"tr","Children":[{"Type":"NodeTableCell","Data":"td","Children":[{"Type":"NodeText","Data":"张三"}]},{"Type":"NodeTableCell","Data":"td","Children":[{"Type":"NodeText","Data":"技术部"}]},{"Type":"NodeTableCell","Data":"td","Children":[{"Type":"NodeText","Data":"5500"}]}]}]},{"ID":"20250916165811-nxlfm29","Type":"NodeParagraph","Properties":{"id":"20250916165811-nxlfm29","updated":"20250916165811"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"查找张三在销售部的工资"},{"Type":"NodeText","Data":""}]},{"ID":"20250916165811-byxwmbb","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250916165811-byxwmbb","updated":"20250916165811"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"ZXhjZWw="},{"Type":"NodeCodeBlockCode","Data":"=FILTER(C2:C4, (A2:A4=\"张三\") * (B2:B4=\"销售部\"), \"未找到\")\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250916165811-oqzcat6","Type":"NodeParagraph","Properties":{"id":"20250916165811-oqzcat6","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"结果:"},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"5000"},{"Type":"NodeText","Data":""}]},{"ID":"20250916165811-noyyrne","Type":"NodeHeading","HeadingLevel":2,"Properties":{"id":"20250916165811-noyyrne","updated":"20250917083942"},"Children":[{"Type":"NodeText","Data":"温馨提示"}]},{"ID":"20250916165811-nei6yiv","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250916165811-nei6yiv","updated":"20250916165811"},"Children":[{"ID":"20250916165811-t9pnt5k","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250916165811-t9pnt5k","updated":"20250916165811"},"Children":[{"ID":"20250916165811-86z1gsn","Type":"NodeParagraph","Properties":{"id":"20250916165811-86z1gsn","updated":"20250916165811"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"版本兼容性"},{"Type":"NodeText","Data":"根据你的Excel版本选择合适的方法"}]}]},{"ID":"20250916165811-yzx7jbc","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250916165811-yzx7jbc","updated":"20250916165811"},"Children":[{"ID":"20250916165811-9hd24e4","Type":"NodeParagraph","Properties":{"id":"20250916165811-9hd24e4","updated":"20250916165811"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"错误处理"},{"Type":"NodeText","Data":"使用IFERROR函数处理可能出现的错误"}]}]},{"ID":"20250916165811-haodjnx","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250916165811-haodjnx","updated":"20250916165811"},"Children":[{"ID":"20250916165811-zk8mts9","Type":"NodeParagraph","Properties":{"id":"20250916165811-zk8mts9","updated":"20250916165811"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"精确匹配"},{"Type":"NodeText","Data":":确保条件值完全匹配(包括大小写和空格)"}]}]}]},{"ID":"20250916165811-ijztkq2","Type":"NodeParagraph","Properties":{"id":"20250916165811-ijztkq2","updated":"20250916165811"},"Children":[{"Type":"NodeText","Data":"如果你有具体的数据结构和需求,我可以提供更针对性的解决方案。"}]},{"ID":"20250916184811-xqiupwh","Type":"NodeParagraph","Properties":{"id":"20250916184811-xqiupwh","updated":"20250916184811"}},{"ID":"20250917083521-xyf9w4j","Type":"NodeParagraph","Properties":{"id":"20250917083521-xyf9w4j","updated":"20250917083521"}},{"ID":"20250917083521-9uw7l97","Type":"NodeParagraph","Properties":{"id":"20250917083521-9uw7l97","updated":"20250917083521"}},{"ID":"20250917083526-g9oitvx","Type":"NodeParagraph","Properties":{"id":"20250917083526-g9oitvx","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"当然可以!"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"VBA (Visual Basic for Applications)"},{"Type":"NodeText","Data":" 是 Excel 的编程语言,可以"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"自动化"},{"Type":"NodeText","Data":"完成包括分组汇总在内的几乎所有操作。虽然对于简单的分组汇总,更推荐直接用"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"数据透视表"},{"Type":"NodeText","Data":"(不需要编程),但如果你需要"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"自动化重复性任务"},{"Type":"NodeText","Data":"、"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"定制特殊需求"},{"Type":"NodeText","Data":",或"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"将汇总结果精确放置到特定位置"},{"Type":"NodeText","Data":"VBA 就非常强大。"}]},{"ID":"20250917083526-gew58ni","Type":"NodeParagraph","Properties":{"id":"20250917083526-gew58ni","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"下面我将为你展示如何用 VBA 实现两种主要的分组汇总方法。"}]},{"ID":"20250917083526-3cfrdym","Type":"NodeThematicBreak","Properties":{"id":"20250917083526-3cfrdym","updated":"20250917083526"}},{"ID":"20250917083526-b40h6n9","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917083526-b40h6n9","updated":"20250917083942"},"Children":[{"Type":"NodeText","Data":"方法一:用 VBA 创建数据透视表(最推荐)"}]},{"ID":"20250917083526-8vzou50","Type":"NodeParagraph","Properties":{"id":"20250917083526-8vzou50","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"这是最灵活、最高效的方式,让 VBA 替你完成拖拽字段的操作。"}]},{"ID":"20250917083526-8ipsoro","Type":"NodeParagraph","Properties":{"id":"20250917083526-8ipsoro","updated":"20250917083526"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"场景"},{"Type":"NodeText","Data":":假设你的数据在 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Sheet1"},{"Type":"NodeText","Data":" 中,第一行是标题(如 “部门”, “销售额” 等)。我们想在 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Sheet2"},{"Type":"NodeText","Data":" 中创建一个数据透视表,按“部门”对“销售额”进行求和。"}]},{"ID":"20250917083526-m4hnzyk","Type":"NodeParagraph","Properties":{"id":"20250917083526-m4hnzyk","updated":"20250917083526"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"VBA 代码示例"},{"Type":"NodeText","Data":""}]},{"ID":"20250917083526-2z2vrga","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917083526-2z2vrga","updated":"20250917083942"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub CreateSummaryWithPivotTable()\n \n Dim wsData As Worksheet, wsDest As Worksheet\n Dim pvtCache As PivotCache\n Dim pvtTable As PivotTable\n Dim LastRow As Long, LastCol As Long\n Dim DataRange As Range\n \n Application.ScreenUpdating = False\n Application.Calculation = xlCalculationManual\n \n Set wsData = ThisWorkbook.Worksheets(\"Output\")\n Set wsDest = ThisWorkbook.Worksheets(\"cutput\") \n\n LastRow = wsData.Cells(wsData.Rows.Count, 1).End(xlUp).Row\n LastCol = wsData.Cells(1, wsData.Columns.Count).End(xlToLeft).Column\n Set DataRange = wsData.Range(wsData.Cells(1, 1), wsData.Cells(LastRow, LastCol))\n \n Set pvtCache = ThisWorkbook.PivotCaches.Create( _\n SourceType:=xlDatabase, _\n SourceData:=DataRange)\n \n Set pvtTable = pvtCache.CreatePivotTable( _\n TableDestination:=wsDest.Range(\"A3\"), _ \n TableName:=\"MyPivotTable\")\n \n With pvtTable\n\n .PivotFields(\"Material Number\").Orientation = xlRowField \n \n With .PivotFields(\"WEEK1\") ' \n .Orientation = xlDataField\n .Function = xlSum \n .NumberFormat = \"#,##0\" \n End With\n End With\n \n \n pvtTable.TableStyle2 = \"PivotStyleMedium9\"\n \n \n Application.Calculation = xlCalculationAutomatic\n Application.ScreenUpdating = True\n \n MsgBox \"wanchen\"\nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250917083526-imbmxea","Type":"NodeParagraph","Properties":{"id":"20250917083526-imbmxea","updated":"20250917083526"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"如何运行这段代码"},{"Type":"NodeText","Data":""}]},{"ID":"20250917083526-33puuvq","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250917083526-33puuvq","updated":"20250917083526"},"Children":[{"ID":"20250917083526-uxf3pep","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250917083526-uxf3pep","updated":"20250917083526"},"Children":[{"ID":"20250917083526-9bc4f52","Type":"NodeParagraph","Properties":{"id":"20250917083526-9bc4f52","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"在 Excel 中,按 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Alt + F11"},{"Type":"NodeText","Data":" 打开 VBA 编辑器。"}]}]},{"ID":"20250917083526-6vzj3rs","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250917083526-6vzj3rs","updated":"20250917083526"},"Children":[{"ID":"20250917083526-jbyn07u","Type":"NodeParagraph","Properties":{"id":"20250917083526-jbyn07u","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"在左侧“工程资源管理器”中,右键点击你的工作簿名称 -\u003e "},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"插入"},{"Type":"NodeText","Data":" -\u003e "},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"模块"},{"Type":"NodeText","Data":"。"}]}]},{"ID":"20250917083526-0tj69k0","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250917083526-0tj69k0","updated":"20250917083526"},"Children":[{"ID":"20250917083526-engpev8","Type":"NodeParagraph","Properties":{"id":"20250917083526-engpev8","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"将上面的代码粘贴到新出现的代码窗口中。"}]}]},{"ID":"20250917083526-0e7hwln","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NC4=","Num":4},"Properties":{"id":"20250917083526-0e7hwln","updated":"20250917083526"},"Children":[{"ID":"20250917083526-hk8rq8d","Type":"NodeParagraph","Properties":{"id":"20250917083526-hk8rq8d","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"修改代码中的工作表名("},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Sheet1"},{"Type":"NodeText","Data":", "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Sheet2"},{"Type":"NodeText","Data":"​)和字段名("},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"部门"},{"Type":"NodeText","Data":", "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"销售额"},{"Type":"NodeText","Data":"​)以匹配你的数据。"}]}]},{"ID":"20250917083526-6lsqhro","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NS4=","Num":5},"Properties":{"id":"20250917083526-6lsqhro","updated":"20250917083526"},"Children":[{"ID":"20250917083526-qjhv0p9","Type":"NodeParagraph","Properties":{"id":"20250917083526-qjhv0p9","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"按 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"F5"},{"Type":"NodeText","Data":" 键或点击工具栏上的“运行”按钮执行宏。"}]}]}]},{"ID":"20250917083526-ay9utfb","Type":"NodeThematicBreak","Properties":{"id":"20250917083526-ay9utfb","updated":"20250917083526"}},{"ID":"20250917083526-ec2psxx","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917083526-ec2psxx","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"方法二:用 VBA 编写循环进行汇总(更底层控制)"}]},{"ID":"20250917083526-lu29tl2","Type":"NodeParagraph","Properties":{"id":"20250917083526-lu29tl2","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"如果你需要非常定制化的汇总逻辑,或者数据不适合用透视表,可以用循环的方式遍历数据。"}]},{"ID":"20250917083526-h6r24hh","Type":"NodeParagraph","Properties":{"id":"20250917083526-h6r24hh","updated":"20250917083526"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"场景"},{"Type":"NodeText","Data":":同样按“部门”汇总“销售额”,但我们将结果输出到指定位置,并完全控制过程。"}]},{"ID":"20250917083526-0xo9a1t","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917083526-0xo9a1t","updated":"20250917083526"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub CreateSummaryWithLoop()\n Dim ws As Worksheet\n Dim LastRow As Long, i As Long\n Dim dict As Object\n Dim Dept As String\n Dim Sales As Double\n Dim OutputRow As Long\n \n Application.ScreenUpdating = False\n Set ws = ThisWorkbook.Worksheets(\"Sheet1\") ' 改为你的数据表名\n Set dict = CreateObject(\"Scripting.Dictionary\") ' 创建字典对象用于存储分组汇总结果\n \n ' 查找数据最后一行\n LastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row\n \n ' 循环遍历每一行数据 (从第2行开始假设第1行是标题)\n For i = 2 To LastRow\n Dept = ws.Cells(i, 1).Value ' 假设“部门”在第1列 (A列)\n Sales = ws.Cells(i, 2).Value ' 假设“销售额”在第2列 (B列)\n \n ' 检查字典中是否已有该部门\n If dict.Exists(Dept) Then\n ' 如果已有,则将销售额累加\n dict(Dept) = dict(Dept) + Sales\n Else\n ' 如果没有,则添加新键值对\n dict.Add Dept, Sales\n End If\n Next i\n \n ' 清空并准备输出到 Sheet2\n With ThisWorkbook.Worksheets(\"Sheet2\") ' 改为你的目标表名\n .Cells.Clear\n .Range(\"A1\").Value = \"部门\"\n .Range(\"B1\").Value = \"销售总额\"\n OutputRow = 2\n \n ' 将字典中的汇总结果输出到工作表\n For Each Dept In dict.Keys\n .Cells(OutputRow, 1).Value = Dept\n .Cells(OutputRow, 2).Value = dict(Dept)\n OutputRow = OutputRow + 1\n Next Dept\n \n ' 自动调整列宽\n .Columns(\"A:B\").AutoFit\n End With\n \n Application.ScreenUpdating = True\n MsgBox \"循环汇总已完成!共汇总 \" \u0026 dict.Count \u0026 \" 个部门。\"\n Set dict = Nothing\nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250917083526-5f49ipt","Type":"NodeThematicBreak","Properties":{"id":"20250917083526-5f49ipt","updated":"20250917083526"}},{"ID":"20250917083526-s6ozqix","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917083526-s6ozqix","updated":"20250917084740"},"Children":[{"Type":"NodeText","Data":"总结与建议"}]},{"ID":"20250917083526-y9hxmzy","Type":"NodeTable","TableAligns":[1,1,1],"Properties":{"colgroup":"||","id":"20250917083526-y9hxmzy","updated":"20250917083526"},"Children":[{"Type":"NodeTableHead","Data":"thead","Children":[{"Type":"NodeTableRow","Data":"tr","Children":[{"Type":"NodeTableCell","Data":"th","TableCellAlign":1,"Children":[{"Type":"NodeText","Data":"特性"}]},{"Type":"NodeTableCell","Data":"th","TableCellAlign":1,"Children":[{"Type":"NodeText","Data":"VBA 数据透视表"}]},{"Type":"NodeTableCell","Data":"th","TableCellAlign":1,"Children":[{"Type":"NodeText","Data":"VBA 循环"}]}]}]},{"Type":"NodeTableRow","Data":"tr","Children":[{"Type":"NodeTableCell","Data":"td","TableCellAlign":1,"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"优点"}]},{"Type":"NodeTableCell","Data":"td","TableCellAlign":1,"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"高效、快速"},{"Type":"NodeText","Data":",尤其处理大数据量时。功能强大,布局灵活。"}]},{"Type":"NodeTableCell","Data":"td","TableCellAlign":1,"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"控制力极强"},{"Type":"NodeText","Data":",可以实现任何自定义逻辑和输出格式。"}]}]},{"Type":"NodeTableRow","Data":"tr","Children":[{"Type":"NodeTableCell","Data":"td","TableCellAlign":1,"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"缺点"}]},{"Type":"NodeTableCell","Data":"td","TableCellAlign":1,"Children":[{"Type":"NodeText","Data":"需要学习数据透视表对象模型。"}]},{"Type":"NodeTableCell","Data":"td","TableCellAlign":1,"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"速度较慢"},{"Type":"NodeText","Data":"(大数据量时),代码更复杂。"}]}]},{"Type":"NodeTableRow","Data":"tr","Children":[{"Type":"NodeTableCell","Data":"td","TableCellAlign":1,"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"适用场景"}]},{"Type":"NodeTableCell","Data":"td","TableCellAlign":1,"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"绝大多数"},{"Type":"NodeText","Data":"需要自动化分组汇总的情况。"}]},{"Type":"NodeTableCell","Data":"td","TableCellAlign":1,"Children":[{"Type":"NodeText","Data":"标准数据透视表无法实现的"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"特殊、复杂"},{"Type":"NodeText","Data":"的汇总逻辑。"}]}]}]},{"ID":"20250917083526-lzm871l","Type":"NodeParagraph","Properties":{"id":"20250917083526-lzm871l","updated":"20250917083526"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"给你的建议"},{"Type":"NodeText","Data":""}]},{"ID":"20250917083526-ncsfd74","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250917083526-ncsfd74","updated":"20250917083526"},"Children":[{"ID":"20250917083526-y0vxynd","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250917083526-y0vxynd","updated":"20250917083526"},"Children":[{"ID":"20250917083526-57e11we","Type":"NodeParagraph","Properties":{"id":"20250917083526-57e11we","updated":"20250917083526"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"优先使用方法一VBA创建数据透视表"},{"Type":"NodeText","Data":",它是功能性和效率的最佳结合。"}]}]},{"ID":"20250917083526-6tafy76","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250917083526-6tafy76","updated":"20250917083526"},"Children":[{"ID":"20250917083526-msjubpf","Type":"NodeParagraph","Properties":{"id":"20250917083526-msjubpf","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"只有在数据透视表无法满足你的"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"特定输出格式"},{"Type":"NodeText","Data":"或"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"计算逻辑"},{"Type":"NodeText","Data":"时,才考虑编写循环代码。"}]}]},{"ID":"20250917083526-1crjvcu","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250917083526-1crjvcu","updated":"20250917083526"},"Children":[{"ID":"20250917083526-1hqj96l","Type":"NodeParagraph","Properties":{"id":"20250917083526-1hqj96l","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"始终在代码开始时加上 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Application.ScreenUpdating = False"},{"Type":"NodeText","Data":" 结束时加上 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Application.ScreenUpdating = True"},{"Type":"NodeText","Data":"​,这会极大提高运行速度。"}]}]}]},{"ID":"20250917083526-ub5t9lt","Type":"NodeParagraph","Properties":{"id":"20250917083526-ub5t9lt","updated":"20250917083526"},"Children":[{"Type":"NodeText","Data":"希望这能帮到你!你可以根据实际需求修改这些代码。"}]},{"ID":"20250917084734-rq4gqz9","Type":"NodeParagraph","Properties":{"id":"20250917084734-rq4gqz9","updated":"20250917084734"}},{"ID":"20250917084735-vmobpgb","Type":"NodeParagraph","Properties":{"id":"20250917084735-vmobpgb","updated":"20250917084735"}},{"ID":"20250917084740-ghdm0rk","Type":"NodeParagraph","Properties":{"id":"20250917084740-ghdm0rk","updated":"20250917084740"},"Children":[{"Type":"NodeText","Data":"好的没有问题。以下是一段可以直接使用的VBA代码它会自动创建数据透视表按"},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Material Number"},{"Type":"NodeText","Data":"​分组并对"},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"week1"},{"Type":"NodeText","Data":"​到"},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"week56"},{"Type":"NodeText","Data":"​进行求和汇总。"}]},{"ID":"20250917084740-29te4wf","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917084740-29te4wf","updated":"20250917084929"},"Children":[{"Type":"NodeText","Data":"VBA 代码"}]},{"ID":"20250917084740-kuhzq1q","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917084740-kuhzq1q","updated":"20250917084929"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub CreatePivotTableForWeeks()\n \n ' 定义变量\n Dim wsSource As Worksheet, wsDest As Worksheet\n Dim pvtCache As PivotCache\n Dim pvtTable As PivotTable\n Dim LastRow As Long, LastCol As Long\n Dim SourceDataRange As Range\n Dim i As Integer\n Dim FieldName As String\n \n ' 禁用屏幕更新和自动计算以提高速度\n Application.ScreenUpdating = False\n Application.Calculation = xlCalculationManual\n \n ' 设置源数据工作表\n ' 请将 \"Sheet1\" 修改为您的数据所在的工作表名称\n Set wsSource = ThisWorkbook.Worksheets(\"Output\")\n \n ' 创建一个新的工作表来放置数据透视表\n Set wsDest = ThisWorkbook.Worksheets.Add\n wsDest.Name = \"Cutput\" ' \n \n ' 查找源数据的最后一行和最后一列,以定义动态数据范围\n LastRow = wsSource.Cells(wsSource.Rows.Count, 1).End(xlUp).Row\n LastCol = wsSource.Cells(1, wsSource.Columns.Count).End(xlToLeft).Column\n Set SourceDataRange = wsSource.Range(wsSource.Cells(1, 1), wsSource.Cells(LastRow, LastCol))\n \n ' 创建数据透视表缓存\n Set pvtCache = ThisWorkbook.PivotCaches.Create( _\n SourceType:=xlDatabase, _\n SourceData:=SourceDataRange)\n \n ' 在目标工作表创建数据透视表\n Set pvtTable = pvtCache.CreatePivotTable( _\n TableDestination:=wsDest.Range(\"A3\"), _\n TableName:=\"WeeklySummaryPivot\")\n \n ' 布局数据透视表字段\n With pvtTable\n ' 添加行字段(分组依据)\n .PivotFields(\"Material Number\").Orientation = xlRowField\n \n ' 循环添加所有周字段week1 到 week56到值区域并设置为求和\n For i = 2 To LastCol ' 从第2列循环到最后一列假设第1列是Material Number\n FieldName = wsSource.Cells(1, i).Value ' 获取列标题(如 \"week1\"\n ' 确保只添加包含\"week\"的列,避免意外添加其他列\n If InStr(1, FieldName, \"week\", vbTextCompare) \u003e 0 Then\n With .PivotFields(FieldName)\n .Orientation = xlDataField\n .Function = xlSum\n .NumberFormat = \"#,##0\" ' 设置数字格式,便于阅读\n End With\n End If\n Next i\n End With\n \n ' (可选)美化数据透视表:应用一个预定义的样式\n pvtTable.TableStyle2 = \"PivotStyleMedium9\"\n \n ' 恢复屏幕更新和自动计算\n Application.Calculation = xlCalculationAutomatic\n Application.ScreenUpdating = True\n \n ' 提示完成\n MsgBox \"数据透视表已创建完成!位于工作表: \" \u0026 wsDest.Name, vbInformation\n \nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250917084740-z05mf4g","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917084740-z05mf4g","updated":"20250917084740"},"Children":[{"Type":"NodeText","Data":"使用前请修改:"}]},{"ID":"20250917084740-3lbwkp4","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250917084740-3lbwkp4","updated":"20250917084740"},"Children":[{"ID":"20250917084740-6641p7h","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250917084740-6641p7h","updated":"20250917084740"},"Children":[{"ID":"20250917084740-izx8xpp","Type":"NodeParagraph","Properties":{"id":"20250917084740-izx8xpp","updated":"20250917084740"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"源工作表名称"},{"Type":"NodeText","Data":":代码中 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Set wsSource = ThisWorkbook.Worksheets(\"Sheet1\")"},{"Type":"NodeText","Data":" 这一行,请将 "},{"Type":"NodeTextMark","TextMarkType":"strong code","TextMarkTextContent":"\"Sheet1\""},{"Type":"NodeText","Data":" 替换为您实际的数据源工作表名称。"}]}]}]},{"ID":"20250917084740-deyl9nj","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917084740-deyl9nj","updated":"20250917084740"},"Children":[{"Type":"NodeText","Data":"如何使用这段代码:"}]},{"ID":"20250917084740-kjuw58c","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250917084740-kjuw58c","updated":"20250917084740"},"Children":[{"ID":"20250917084740-d1fenqg","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250917084740-d1fenqg","updated":"20250917084740"},"Children":[{"ID":"20250917084740-wq1ti3k","Type":"NodeParagraph","Properties":{"id":"20250917084740-wq1ti3k","updated":"20250917084740"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"打开VBA编辑器"},{"Type":"NodeText","Data":"在Excel中按下 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Alt + F11"},{"Type":"NodeText","Data":" 键。"}]}]},{"ID":"20250917084740-6cjg4vc","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250917084740-6cjg4vc","updated":"20250917084740"},"Children":[{"ID":"20250917084740-2fw8v4z","Type":"NodeParagraph","Properties":{"id":"20250917084740-2fw8v4z","updated":"20250917084740"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"插入模块"},{"Type":"NodeText","Data":":在左侧“工程资源管理器”中,右键点击您的 workbook 名称(例如 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"VBAProject (你的文件名.xlsx)"},{"Type":"NodeText","Data":"​),选择 "},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"【插入】 -\u0026gt; 【模块】"},{"Type":"NodeText","Data":"。"}]}]},{"ID":"20250917084740-z2erphc","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250917084740-z2erphc","updated":"20250917084740"},"Children":[{"ID":"20250917084740-0odjuyr","Type":"NodeParagraph","Properties":{"id":"20250917084740-0odjuyr","updated":"20250917084740"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"粘贴代码"},{"Type":"NodeText","Data":":将上面的完整代码复制并粘贴到新出现的白色代码窗口中。"}]}]},{"ID":"20250917084740-t1qora1","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NC4=","Num":4},"Properties":{"id":"20250917084740-t1qora1","updated":"20250917084740"},"Children":[{"ID":"20250917084740-opb2tma","Type":"NodeParagraph","Properties":{"id":"20250917084740-opb2tma","updated":"20250917084740"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"运行代码"},{"Type":"NodeText","Data":""}]},{"ID":"20250917084740-04infdd","Type":"NodeList","ListData":{},"Properties":{"id":"20250917084740-04infdd","updated":"20250917084740"},"Children":[{"ID":"20250917084740-gkguh8o","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917084740-gkguh8o","updated":"20250917084740"},"Children":[{"ID":"20250917084740-55d8d2y","Type":"NodeParagraph","Properties":{"id":"20250917084740-55d8d2y","updated":"20250917084740"},"Children":[{"Type":"NodeText","Data":"按 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"F5"},{"Type":"NodeText","Data":" 键,或者"}]}]},{"ID":"20250917084740-w66mzvv","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917084740-w66mzvv","updated":"20250917084740"},"Children":[{"ID":"20250917084740-v2t6she","Type":"NodeParagraph","Properties":{"id":"20250917084740-v2t6she","updated":"20250917084740"},"Children":[{"Type":"NodeText","Data":"点击工具栏上的绿色“运行”小三角按钮。"}]}]}]}]},{"ID":"20250917084740-20zdbje","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NS4=","Num":5},"Properties":{"id":"20250917084740-20zdbje","updated":"20250917084740"},"Children":[{"ID":"20250917084740-hm7dh5o","Type":"NodeParagraph","Properties":{"id":"20250917084740-hm7dh5o","updated":"20250917084740"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"查看结果"},{"Type":"NodeText","Data":":代码会自动创建一个名为 "},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"“PivotTable Summary”"},{"Type":"NodeText","Data":" 的新工作表,里面就是生成好的数据透视表。"}]}]}]},{"ID":"20250917084740-0q0e4k7","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917084740-0q0e4k7","updated":"20250917093020"},"Children":[{"Type":"NodeText","Data":"代码工作原理:"}]},{"ID":"20250917084740-u51n5w8","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250917084740-u51n5w8","updated":"20250917084740"},"Children":[{"ID":"20250917084740-2tdtuhe","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250917084740-2tdtuhe","updated":"20250917084740"},"Children":[{"ID":"20250917084740-nkwild9","Type":"NodeParagraph","Properties":{"id":"20250917084740-nkwild9","updated":"20250917084740"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"定位数据"},{"Type":"NodeText","Data":":自动查找您数据表的最后一行和最后一列,确定整个数据范围。您无需手动选择区域。"}]}]},{"ID":"20250917084740-uyvu574","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250917084740-uyvu574","updated":"20250917084740"},"Children":[{"ID":"20250917084740-e65t4m3","Type":"NodeParagraph","Properties":{"id":"20250917084740-e65t4m3","updated":"20250917084740"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"创建透视表"},{"Type":"NodeText","Data":":在新的工作表中创建透视表。"}]}]},{"ID":"20250917084740-4bm2a9n","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250917084740-4bm2a9n","updated":"20250917084740"},"Children":[{"ID":"20250917084740-zonp4nl","Type":"NodeParagraph","Properties":{"id":"20250917084740-zonp4nl","updated":"20250917084740"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"添加字段"},{"Type":"NodeText","Data":""}]},{"ID":"20250917084740-1zzz9uk","Type":"NodeList","ListData":{},"Properties":{"id":"20250917084740-1zzz9uk","updated":"20250917084740"},"Children":[{"ID":"20250917084740-4u2p5hw","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917084740-4u2p5hw","updated":"20250917084740"},"Children":[{"ID":"20250917084740-ioko6xr","Type":"NodeParagraph","Properties":{"id":"20250917084740-ioko6xr","updated":"20250917084740"},"Children":[{"Type":"NodeText","Data":"将 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Material Number"},{"Type":"NodeText","Data":" 字段添加到"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"行区域"},{"Type":"NodeText","Data":",作为分组依据。"}]}]},{"ID":"20250917084740-4vfazqy","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917084740-4vfazqy","updated":"20250917084740"},"Children":[{"ID":"20250917084740-f7pc1v9","Type":"NodeParagraph","Properties":{"id":"20250917084740-f7pc1v9","updated":"20250917084740"},"Children":[{"Type":"NodeText","Data":"使用循环自动将第2列到最后一列即 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"week1"},{"Type":"NodeText","Data":" 到 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"week56"},{"Type":"NodeText","Data":"​)的所有字段添加到"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"值区域"},{"Type":"NodeText","Data":",并设置其计算方式为"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"求和xlSum"},{"Type":"NodeText","Data":"。"}]}]},{"ID":"20250917084740-qucpr9y","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917084740-qucpr9y","updated":"20250917084740"},"Children":[{"ID":"20250917084740-jzktu28","Type":"NodeParagraph","Properties":{"id":"20250917084740-jzktu28","updated":"20250917084740"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"If InStr(..."},{"Type":"NodeText","Data":" 这一行是一个安全措施确保只处理列标题中包含“week”的列避免误处理其他数据。"}]}]}]}]},{"ID":"20250917084740-vqzumtl","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NC4=","Num":4},"Properties":{"id":"20250917084740-vqzumtl","updated":"20250917084740"},"Children":[{"ID":"20250917084740-x609iv1","Type":"NodeParagraph","Properties":{"id":"20250917084740-x609iv1","updated":"20250917084740"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"美化与完成"},{"Type":"NodeText","Data":"为透视表应用一个清晰的样式并恢复Excel的常规设置。"}]}]}]},{"ID":"20250917084740-sngd4m6","Type":"NodeParagraph","Properties":{"id":"20250917084740-sngd4m6","updated":"20250917084740"},"Children":[{"Type":"NodeText","Data":"这段代码高效且自动化,非常适合处理您这种格式固定的大量数据汇总任务。"}]},{"ID":"20250917085246-tnalk3t","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917085246-tnalk3t","updated":"20250917085422"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub CreatePivotTableForWeeks()\n \n ' Define variables\n Dim wsSource As Worksheet, wsDest As Worksheet\n Dim pvtCache As PivotCache\n Dim pvtTable As PivotTable\n Dim LastRow As Long, LastCol As Long\n Dim SourceDataRange As Range\n Dim i As Integer\n Dim FieldName As String\n \n ' Disable screen updating and automatic calculation for performance\n Application.ScreenUpdating = False\n Application.Calculation = xlCalculationManual\n \n ' Set source data worksheet\n ' Change \"Sheet1\" to your actual source worksheet name\n Set wsSource = ThisWorkbook.Worksheets(\"Output\")\n \n ' Create a new worksheet for the pivot table\n Set wsDest = ThisWorkbook.Worksheets.Add\n wsDest.Name = \"Cutput\" ' Name the new worksheet\n \n ' Find the last row and last column of source data to define dynamic range\n LastRow = wsSource.Cells(wsSource.Rows.Count, 1).End(xlUp).Row\n LastCol = wsSource.Cells(1, wsSource.Columns.Count).End(xlToLeft).Column\n Set SourceDataRange = wsSource.Range(wsSource.Cells(1, 1), wsSource.Cells(LastRow, LastCol))\n \n ' Create pivot cache\n Set pvtCache = ThisWorkbook.PivotCaches.Create( _\n SourceType:=xlDatabase, _\n SourceData:=SourceDataRange)\n \n ' Create pivot table in destination worksheet\n Set pvtTable = pvtCache.CreatePivotTable( _\n TableDestination:=wsDest.Range(\"A3\"), _\n TableName:=\"WeeklySummaryPivot\")\n \n ' Configure pivot table fields\n With pvtTable\n ' Add row field (group by)\n .PivotFields(\"Material Number\").Orientation = xlRowField\n \n ' Loop to add all week fields (week1 to week56) to values area and set to sum\n For i = 2 To LastCol ' Loop from column 2 to last column (assuming column 1 is Material Number)\n FieldName = wsSource.Cells(1, i).Value ' Get column header (e.g., \"week1\")\n ' Ensure only columns containing \"week\" are added to avoid processing other columns\n If InStr(1, FieldName, \"week\", vbTextCompare) \u003e 0 Then\n With .PivotFields(FieldName)\n .Orientation = xlDataField\n .Function = xlSum\n .NumberFormat = \"#,##0\" ' Set number format for better readability\n End With\n End If\n Next i\n End With\n \n ' (Optional) Format pivot table: apply a predefined style\n pvtTable.TableStyle2 = \"PivotStyleMedium9\"\n \n ' Restore screen updating and automatic calculation\n Application.Calculation = xlCalculationAutomatic\n Application.ScreenUpdating = True\n \n ' Completion message\n MsgBox \"Pivot table created successfully! Located in worksheet: \" \u0026 wsDest.Name, vbInformation\n \nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250917093016-eglr1w8","Type":"NodeParagraph","Properties":{"id":"20250917093016-eglr1w8","updated":"20250917093016"}},{"ID":"20250917093018-yokwpmj","Type":"NodeParagraph","Properties":{"id":"20250917093018-yokwpmj","updated":"20250917093018"}},{"ID":"20250917093020-qle9984","Type":"NodeParagraph","Properties":{"id":"20250917093020-qle9984","updated":"20250917093020"},"Children":[{"Type":"NodeText","Data":"当然可以!您需要添加代码来检查是否已存在同名的数据透视表或工作表,并在创建新表之前删除它们。以下是优化后的代码:"}]},{"ID":"20250917093020-msx34js","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917093020-msx34js","updated":"20250917093020"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub CreatePivotTableForWeeks()\n \n ' Define variables\n Dim wsSource As Worksheet, wsDest As Worksheet\n Dim pvtCache As PivotCache\n Dim pvtTable As PivotTable\n Dim LastRow As Long, LastCol As Long\n Dim SourceDataRange As Range\n Dim i As Integer\n Dim FieldName As String\n Dim wsExists As Boolean\n Dim ptExists As Boolean\n \n ' Disable screen updating and automatic calculation for performance\n Application.ScreenUpdating = False\n Application.Calculation = xlCalculationManual\n Application.DisplayAlerts = False ' Suppress confirmation messages\n \n ' Set source data worksheet\n Set wsSource = ThisWorkbook.Worksheets(\"Output\")\n \n ' Check if destination worksheet already exists and delete it\n wsExists = False\n On Error Resume Next ' Prevent error if worksheet doesn't exist\n Set wsDest = ThisWorkbook.Worksheets(\"Cutput\")\n On Error GoTo 0\n \n If Not wsDest Is Nothing Then\n Application.DisplayAlerts = False\n wsDest.Delete\n Application.DisplayAlerts = True\n Set wsDest = Nothing\n End If\n \n ' Check if pivot table already exists in any worksheet and delete it\n ptExists = False\n Dim ws As Worksheet\n Dim pt As PivotTable\n For Each ws In ThisWorkbook.Worksheets\n For Each pt In ws.PivotTables\n If pt.Name = \"WeeklySummaryPivot\" Then\n pt.TableRange2.Clear\n ptExists = True\n End If\n Next pt\n Next ws\n \n ' Create a new worksheet for the pivot table\n Set wsDest = ThisWorkbook.Worksheets.Add\n wsDest.Name = \"Cutput\" ' Name the new worksheet\n \n ' Find the last row and last column of source data to define dynamic range\n LastRow = wsSource.Cells(wsSource.Rows.Count, 1).End(xlUp).Row\n LastCol = wsSource.Cells(1, wsSource.Columns.Count).End(xlToLeft).Column\n Set SourceDataRange = wsSource.Range(wsSource.Cells(1, 1), wsSource.Cells(LastRow, LastCol))\n \n ' Create pivot cache\n Set pvtCache = ThisWorkbook.PivotCaches.Create( _\n SourceType:=xlDatabase, _\n SourceData:=SourceDataRange)\n \n ' Create pivot table in destination worksheet - start at A1 for better positioning\n Set pvtTable = pvtCache.CreatePivotTable( _\n TableDestination:=wsDest.Range(\"A1\"), _\n TableName:=\"WeeklySummaryPivot\")\n \n ' Configure pivot table fields\n With pvtTable\n ' Change layout to tabular form for more compact display\n .RowAxisLayout xlTabularRow\n \n ' Add row field (group by)\n .PivotFields(\"Material Number\").Orientation = xlRowField\n \n ' Loop to add all week fields (week1 to week56) to values area and set to sum\n For i = 2 To LastCol\n FieldName = wsSource.Cells(1, i).Value\n If InStr(1, FieldName, \"week\", vbTextCompare) \u003e 0 Then\n With .PivotFields(FieldName)\n .Orientation = xlDataField\n .Function = xlSum\n .NumberFormat = \"#,##0\"\n ' Remove \"Sum of\" prefix for cleaner headers\n .Caption = Replace(.Caption, \"Sum of \", \"\")\n End With\n End If\n Next i\n \n ' Additional formatting options\n .ShowTableStyleRowStripes = True\n .ShowTableStyleColumnStripes = False\n End With\n \n ' Apply a predefined style\n pvtTable.TableStyle2 = \"PivotStyleMedium9\"\n \n ' Auto-fit columns for better visibility\n wsDest.Columns(\"A:BC\").AutoFit\n \n ' Restore settings\n Application.DisplayAlerts = True\n Application.Calculation = xlCalculationAutomatic\n Application.ScreenUpdating = True\n \n ' Completion message\n MsgBox \"Pivot table created successfully! Located in worksheet: \" \u0026 wsDest.Name, vbInformation\n \nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250917093020-qmr17qq","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917093020-qmr17qq","updated":"20250917093020"},"Children":[{"Type":"NodeText","Data":"主要优化内容:"}]},{"ID":"20250917093020-1ed3oqm","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250917093020-1ed3oqm","updated":"20250917093020"},"Children":[{"ID":"20250917093020-k3e57ou","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250917093020-k3e57ou","updated":"20250917093020"},"Children":[{"ID":"20250917093020-s1g8krp","Type":"NodeParagraph","Properties":{"id":"20250917093020-s1g8krp","updated":"20250917093020"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"删除现有工作表"},{"Type":"NodeText","Data":":代码会检查是否存在名为\"Cutput\"的工作表,如果存在则自动删除"}]}]},{"ID":"20250917093020-4okjaqj","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250917093020-4okjaqj","updated":"20250917093020"},"Children":[{"ID":"20250917093020-6hhwki7","Type":"NodeParagraph","Properties":{"id":"20250917093020-6hhwki7","updated":"20250917093020"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"删除现有数据透视表"},{"Type":"NodeText","Data":":遍历所有工作表,查找并清除名为\"WeeklySummaryPivot\"的数据透视表"}]}]},{"ID":"20250917093020-9s1z4dn","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250917093020-9s1z4dn","updated":"20250917093020"},"Children":[{"ID":"20250917093020-a58ir84","Type":"NodeParagraph","Properties":{"id":"20250917093020-a58ir84","updated":"20250917093020"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"错误处理"},{"Type":"NodeText","Data":":使用 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"On Error Resume Next"},{"Type":"NodeText","Data":" 来避免工作表不存在时出现错误"}]}]},{"ID":"20250917093020-rarmueh","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NC4=","Num":4},"Properties":{"id":"20250917093020-rarmueh","updated":"20250917093020"},"Children":[{"ID":"20250917093020-xq640j4","Type":"NodeParagraph","Properties":{"id":"20250917093020-xq640j4","updated":"20250917093020"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"禁用确认提示"},{"Type":"NodeText","Data":""},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Application.DisplayAlerts = False"},{"Type":"NodeText","Data":" 防止Excel显示删除确认对话框"}]}]},{"ID":"20250917093020-3juiweo","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"NS4=","Num":5},"Properties":{"id":"20250917093020-3juiweo","updated":"20250917093020"},"Children":[{"ID":"20250917093020-krb5ghq","Type":"NodeParagraph","Properties":{"id":"20250917093020-krb5ghq","updated":"20250917093020"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"恢复设置"},{"Type":"NodeText","Data":":在过程结束时恢复所有应用程序设置"}]}]}]},{"ID":"20250917093020-z2i3sg9","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917093020-z2i3sg9","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"工作流程:"}]},{"ID":"20250917093020-opyge9l","Type":"NodeList","ListData":{},"Properties":{"id":"20250917093020-opyge9l","updated":"20250917093020"},"Children":[{"ID":"20250917093020-3ytme4z","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917093020-3ytme4z","updated":"20250917093020"},"Children":[{"ID":"20250917093020-8oqfp4t","Type":"NodeParagraph","Properties":{"id":"20250917093020-8oqfp4t","updated":"20250917093020"},"Children":[{"Type":"NodeText","Data":"运行宏时,它会先检查并删除同名的\"Cutput\"工作表"}]}]},{"ID":"20250917093020-thftfgr","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917093020-thftfgr","updated":"20250917093020"},"Children":[{"ID":"20250917093020-fd6adjl","Type":"NodeParagraph","Properties":{"id":"20250917093020-fd6adjl","updated":"20250917093020"},"Children":[{"Type":"NodeText","Data":"检查并删除所有工作表中同名的数据透视表"}]}]},{"ID":"20250917093020-a5v90bv","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917093020-a5v90bv","updated":"20250917093020"},"Children":[{"ID":"20250917093020-89spyen","Type":"NodeParagraph","Properties":{"id":"20250917093020-89spyen","updated":"20250917093020"},"Children":[{"Type":"NodeText","Data":"创建新的\"Cutput\"工作表和数据透视表"}]}]},{"ID":"20250917093020-fyveoo3","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917093020-fyveoo3","updated":"20250917093020"},"Children":[{"ID":"20250917093020-kbndab0","Type":"NodeParagraph","Properties":{"id":"20250917093020-kbndab0","updated":"20250917093020"},"Children":[{"Type":"NodeText","Data":"完成后显示成功消息"}]}]}]},{"ID":"20250917093020-fmx13pt","Type":"NodeParagraph","Properties":{"id":"20250917093020-fmx13pt","updated":"20250917093020"},"Children":[{"Type":"NodeText","Data":"这样您就可以多次运行这个宏,而不需要手动删除之前创建的表了。"}]},{"ID":"20250917093405-vpy9z73","Type":"NodeParagraph","Properties":{"id":"20250917093405-vpy9z73","updated":"20250917093405"}},{"ID":"20250917093406-jcdx1xv","Type":"NodeParagraph","Properties":{"id":"20250917093406-jcdx1xv","updated":"20250917093406"}},{"ID":"20250917093407-ub8d65u","Type":"NodeParagraph","Properties":{"id":"20250917093407-ub8d65u","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"好的在Excel VBA中让一个VBA过程Sub执行另一个VBA过程非常简单。您有多种方法可以实现最基本和常见的方法是使用 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Call"},{"Type":"NodeText","Data":" 语句,或者直接输入过程名称。"}]},{"ID":"20250917093407-ip8tpvv","Type":"NodeParagraph","Properties":{"id":"20250917093407-ip8tpvv","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"假设您有两个宏Sub"}]},{"ID":"20250917093407-62xfsw7","Type":"NodeList","ListData":{},"Properties":{"id":"20250917093407-62xfsw7","updated":"20250917093407"},"Children":[{"ID":"20250917093407-8ikvm6i","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917093407-8ikvm6i","updated":"20250917093407"},"Children":[{"ID":"20250917093407-dozipji","Type":"NodeParagraph","Properties":{"id":"20250917093407-dozipji","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Sub FirstMacro()"},{"Type":"NodeText","Data":""}]}]},{"ID":"20250917093407-0y81h4w","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917093407-0y81h4w","updated":"20250917093407"},"Children":[{"ID":"20250917093407-9h6qv1a","Type":"NodeParagraph","Properties":{"id":"20250917093407-9h6qv1a","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Sub SecondMacro()"},{"Type":"NodeText","Data":""}]}]}]},{"ID":"20250917093407-n1adx0n","Type":"NodeParagraph","Properties":{"id":"20250917093407-n1adx0n","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"您希望先完全执行 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"FirstMacro"},{"Type":"NodeText","Data":"​,然后再执行 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"SecondMacro"},{"Type":"NodeText","Data":"​。"}]},{"ID":"20250917093407-7az4igh","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917093407-7az4igh","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"方法一:使用 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Call"},{"Type":"NodeText","Data":" 语句(推荐,清晰明了)"}]},{"ID":"20250917093407-tm2dl0y","Type":"NodeParagraph","Properties":{"id":"20250917093407-tm2dl0y","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Call"},{"Type":"NodeText","Data":" 关键字会明确地调用另一个过程。如果被调用的过程需要参数,参数必须用括号括起来。"}]},{"ID":"20250917093407-k3855ue","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917093407-k3855ue","updated":"20250917093407"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub MainMacro()\n ' 首先执行第一个宏\n Call FirstMacro\n \n ' 然后执行第二个宏\n Call SecondMacro\n \n ' ... 之后可以执行其他代码\nEnd Sub\n\nSub FirstMacro()\n MsgBox \"第一个宏正在执行\"\n ' 这里放置第一个宏的实际代码\nEnd Sub\n\nSub SecondMacro()\n MsgBox \"第二个宏正在执行\"\n ' 这里放置第二个宏的实际代码\nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250917093407-xdsqwem","Type":"NodeParagraph","Properties":{"id":"20250917093407-xdsqwem","updated":"20250917093407"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"运行"},{"Type":"NodeText","Data":" "},{"Type":"NodeTextMark","TextMarkType":"strong code","TextMarkTextContent":"MainMacro"},{"Type":"NodeText","Data":""},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":",它会按顺序调用"},{"Type":"NodeText","Data":" "},{"Type":"NodeTextMark","TextMarkType":"strong code","TextMarkTextContent":"FirstMacro"},{"Type":"NodeText","Data":""},{"Type":"NodeText","Data":" "},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"和"},{"Type":"NodeText","Data":" "},{"Type":"NodeTextMark","TextMarkType":"strong code","TextMarkTextContent":"SecondMacro"},{"Type":"NodeText","Data":""},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"。"}]},{"ID":"20250917093407-yq0uam0","Type":"NodeThematicBreak","Properties":{"id":"20250917093407-yq0uam0","updated":"20250917093407"}},{"ID":"20250917093407-a4hzk7n","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917093407-a4hzk7n","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"方法二:直接使用过程名"}]},{"ID":"20250917093407-0wow9or","Type":"NodeParagraph","Properties":{"id":"20250917093407-0wow9or","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"你可以省略 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Call"},{"Type":"NodeText","Data":" 关键字,直接写出过程名。这是最简洁的写法。"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"注意:如果被调用的过程有参数,则不能使用括号。"}]},{"ID":"20250917093407-t9vfcy8","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917093407-t9vfcy8","updated":"20250917093407"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub MainMacro()\n ' 首先执行第一个宏\n FirstMacro\n \n ' 然后执行第二个宏\n SecondMacro\n \nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250917093407-0n0zfvd","Type":"NodeThematicBreak","Properties":{"id":"20250917093407-0n0zfvd","updated":"20250917093407"}},{"ID":"20250917093407-b4lbe1j","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917093407-b4lbe1j","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"方法三:使用 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Application.Run"},{"Type":"NodeText","Data":" 方法"}]},{"ID":"20250917093407-ypxvy9l","Type":"NodeParagraph","Properties":{"id":"20250917093407-ypxvy9l","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":""},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Application.Run"},{"Type":"NodeText","Data":" 方法可以运行一个宏或一个用户定义的函数。这种方法在你需要动态构建过程名时特别有用(例如,过程名存储在一个字符串变量里)。"}]},{"ID":"20250917093407-86vml82","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917093407-86vml82","updated":"20250917093407"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub MainMacro()\n ' 首先执行第一个宏\n Application.Run \"FirstMacro\"\n \n ' 然后执行第二个宏\n Application.Run \"SecondMacro\"\n \nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250917093407-z7kdh5a","Type":"NodeThematicBreak","Properties":{"id":"20250917093407-z7kdh5a","updated":"20250917093407"}},{"ID":"20250917093407-3gh6r2p","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917093407-3gh6r2p","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"关键要点和注意事项:"}]},{"ID":"20250917093407-3ma88nf","Type":"NodeList","ListData":{"Typ":1},"Properties":{"id":"20250917093407-3ma88nf","updated":"20250917093407"},"Children":[{"ID":"20250917093407-byno2p9","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"MS4=","Num":1},"Properties":{"id":"20250917093407-byno2p9","updated":"20250917093407"},"Children":[{"ID":"20250917093407-hy68hpm","Type":"NodeParagraph","Properties":{"id":"20250917093407-hy68hpm","updated":"20250917093407"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"执行顺序"},{"Type":"NodeText","Data":"VBA会"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"同步"},{"Type":"NodeText","Data":"执行这些调用。这意味着 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"SecondMacro"},{"Type":"NodeText","Data":" 会在 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"FirstMacro"},{"Type":"NodeText","Data":" "},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"完全结束"},{"Type":"NodeText","Data":"后才会开始。如果 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"FirstMacro"},{"Type":"NodeText","Data":" 需要很长时间运行,界面可能会暂时无响应,直到它完成。"}]}]},{"ID":"20250917093407-htuju4t","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"Mi4=","Num":2},"Properties":{"id":"20250917093407-htuju4t","updated":"20250917093407"},"Children":[{"ID":"20250917093407-mk3o2mg","Type":"NodeParagraph","Properties":{"id":"20250917093407-mk3o2mg","updated":"20250917093407"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"错误处理"},{"Type":"NodeText","Data":":如果 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"FirstMacro"},{"Type":"NodeText","Data":" 中途出错并停止,"},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"SecondMacro"},{"Type":"NodeText","Data":" 将不会被执行。如果你希望即使第一个宏出错,第二个宏也继续运行,或者需要进行特定的错误处理,可以使用 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"On Error"},{"Type":"NodeText","Data":" 语句。"}]},{"ID":"20250917093407-61qakt0","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917093407-61qakt0","updated":"20250917093407"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub MainMacro()\n On Error Resume Next ' 如果出错,继续执行下一行\n Call FirstMacro\n Call SecondMacro\n On Error GoTo 0 ' 恢复正常的错误提示\nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]}]},{"ID":"20250917093407-3bulk8n","Type":"NodeListItem","ListData":{"Typ":1,"Delimiter":46,"Marker":"My4=","Num":3},"Properties":{"id":"20250917093407-3bulk8n","updated":"20250917093407"},"Children":[{"ID":"20250917093407-yvrqbe9","Type":"NodeParagraph","Properties":{"id":"20250917093407-yvrqbe9","updated":"20250917093407"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"参数传递"},{"Type":"NodeText","Data":":如果你的宏需要传递参数,调用方式稍有不同。"}]},{"ID":"20250917093407-oqj838o","Type":"NodeList","ListData":{},"Properties":{"id":"20250917093407-oqj838o","updated":"20250917093407"},"Children":[{"ID":"20250917093407-qumo3re","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917093407-qumo3re","updated":"20250917093407"},"Children":[{"ID":"20250917093407-z36o7n3","Type":"NodeParagraph","Properties":{"id":"20250917093407-z36o7n3","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"使用 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Call"},{"Type":"NodeText","Data":"​:参数必须用括号括起来。"}]},{"ID":"20250917093407-o5kxvci","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917093407-o5kxvci","updated":"20250917093407"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Call MyMacro(Argument1, Argument2)\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]}]},{"ID":"20250917093407-mzy5n2z","Type":"NodeListItem","ListData":{"BulletChar":42,"Marker":"Kg=="},"Properties":{"id":"20250917093407-mzy5n2z","updated":"20250917093407"},"Children":[{"ID":"20250917093407-nnsj6de","Type":"NodeParagraph","Properties":{"id":"20250917093407-nnsj6de","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"不使用 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"Call"},{"Type":"NodeText","Data":""},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"不能"},{"Type":"NodeText","Data":"使用括号。"}]},{"ID":"20250917093407-ezpp9pj","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917093407-ezpp9pj","updated":"20250917093407"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"MyMacro Argument1, Argument2\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]}]}]}]}]},{"ID":"20250917093407-suto9k2","Type":"NodeHeading","HeadingLevel":3,"Properties":{"id":"20250917093407-suto9k2","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"总结"}]},{"ID":"20250917093407-wum0ajd","Type":"NodeParagraph","Properties":{"id":"20250917093407-wum0ajd","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"对于您“先执行第一个,再执行第二个”的需求,"},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"最简单直接的方法是编写一个新的主过程(例如"},{"Type":"NodeText","Data":" "},{"Type":"NodeTextMark","TextMarkType":"strong code","TextMarkTextContent":"MainMacro"},{"Type":"NodeText","Data":""},{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"),在其中按顺序调用你的两个子过程。"}]},{"ID":"20250917093407-ok6fptn","Type":"NodeParagraph","Properties":{"id":"20250917093407-ok6fptn","updated":"20250917093407"},"Children":[{"Type":"NodeTextMark","TextMarkType":"strong","TextMarkTextContent":"推荐代码:"}]},{"ID":"20250917093407-03j35mm","Type":"NodeCodeBlock","IsFencedCodeBlock":true,"Properties":{"id":"20250917093407-03j35mm","updated":"20250917093407"},"Children":[{"Type":"NodeCodeBlockFenceOpenMarker","Data":"```"},{"Type":"NodeCodeBlockFenceInfoMarker","CodeBlockInfo":"dmJh"},{"Type":"NodeCodeBlockCode","Data":"Sub RunInOrder()\n ' 执行第一个VBA过程\n Call YourFirstSubName\n \n ' 执行第二个VBA过程\n Call YourSecondSubName\nEnd Sub\n"},{"Type":"NodeCodeBlockFenceCloseMarker","Data":"```"}]},{"ID":"20250917093407-s5krvzr","Type":"NodeParagraph","Properties":{"id":"20250917093407-s5krvzr","updated":"20250917093407"},"Children":[{"Type":"NodeText","Data":"将 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"YourFirstSubName"},{"Type":"NodeText","Data":" 和 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"YourSecondSubName"},{"Type":"NodeText","Data":" 替换成你实际的过程名称即可。你只需要运行 "},{"Type":"NodeTextMark","TextMarkType":"code","TextMarkTextContent":"RunInOrder"},{"Type":"NodeText","Data":" 这个宏,它就会按顺序完成所有步骤。"}]}]}