[excel] 如何统计字数

1.打开vba管理器

alt F11直接打开

或者 文件 -> 更多 -> 选项 -> 自定义功能区 -> 开发工具

[excel] 如何统计字数

[excel] 如何统计字数

[excel] 如何统计字数

2.编写脚本

右键插入一个模块

[excel] 如何统计字数

双击这个模块名, 会弹出一个框框, 把代码粘贴进去, 然后ctrl s保存

[excel] 如何统计字数

Function CountWords(rng As Range) As Long
    Dim cell As Range
    Dim wordCount As Long

    wordCount = 0

    For Each cell In rng
        wordCount = wordCount + Len(cell.Value)
    Next cell

    CountWords = wordCount
End Function

3.保存文件

如果是你普通excel文件,保存宏时肯定会提示你: 你的文件没启用宏, 是否存一下, 你选择xlsm格式另存为即可, 或者直接在主界面另存为

[excel] 如何统计字数

4.使用

在任意单元格输入=CountWords(A1:B10), 就可以按区域统计了

[excel] 如何统计字数

给TA充电
共{{data.count}}人
人已充电
wordpress软件

[wordpress]强制禁用国外脚本

2023-6-25 18:46:08

vscode软件

[VS Code] 缩进/tabSize 爆红

2024-4-21 4:46:34

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
今日签到
搜索