录制宏虽然简单,但拓展性(可复用性)不强,它仅适合对同一事务的重复。这里我们就来写个简单的宏:向选中的单元格创建一条批注。内容类似 2021-5-29 By 表哥

创建模块并重命名commentHere

new.gif

写宏

  1. /**
  2. * 向选中的单元格插入批注。
  3. */
  4. function commentHere(){
  5. let targ = ActiveCell;
  6. let nowDate = new Intl.DateTimeFormat('zh-CN').format(new Date())
  7. let msg = `已审核-${Application.UserName}_${nowDate}`
  8. targ.AddComment(msg)
  9. }

执行

comment.gif